Spaces:
Runtime error
Runtime error
charlesfrye
commited on
Commit
•
264deb4
1
Parent(s):
407c075
adds remote requests to makefile
Browse files
Makefile
CHANGED
@@ -11,6 +11,21 @@ help: ## get a list of all the targets, and their short descriptions
|
|
11 |
@# source for the incantation: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
12 |
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?##"}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
serve: ## serve this locally
|
16 |
gradio app.py
|
|
|
11 |
@# source for the incantation: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
12 |
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?##"}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
13 |
|
14 |
+
API_URL=https://$(HUGGINGFACE_USERNAME)-ask-fsdl.hf.space/run
|
15 |
+
PROMPT=What is PyTorch?
|
16 |
+
remote_request: ## send a request to the instance on Hugging Face
|
17 |
+
@if [ -z $$(echo $(HUGGINGFACE_USERNAME)) ]; then\
|
18 |
+
echo "###";\
|
19 |
+
echo "# 🥞: Add a HUGGINGFACE_USERNAME to the .env file to run remotely";\
|
20 |
+
echo "###";\
|
21 |
+
else\
|
22 |
+
echo "$(PROMPT)";\
|
23 |
+
echo "###";\
|
24 |
+
echo "# 🥞: Running inference at $(API_URL)";\
|
25 |
+
echo "###";\
|
26 |
+
(echo '{ "data": ["'$(PROMPT)'"]}') \
|
27 |
+
| curl -s -X POST $(API_URL)/predict -H 'Content-Type: application/json' -d @-;\
|
28 |
+
fi
|
29 |
|
30 |
serve: ## serve this locally
|
31 |
gradio app.py
|