Spaces:
Runtime error
Runtime error
Commit
·
b72816e
1
Parent(s):
39fe662
Preparing a Gradio app for Huggingface Spaces
Browse files
README.md
CHANGED
|
@@ -15,6 +15,26 @@ models: ["KBLab/bert-base-swedish-cased-ner"]
|
|
| 15 |
|
| 16 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
## REST API via Gradio “Use via API” (see page footer)
|
| 19 |
|
| 20 |
curl -X POST -H 'Content-type: application/json' --data '{ "data": ["Wirwachs malmgård är en på 1770-talet uppförd egendom som ligger på västra Södermalm i Stockholm."] }' https://tomsoderlund-swedish-entity-recognition.hf.space/run/predict
|
|
|
|
| 15 |
|
| 16 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 17 |
|
| 18 |
+
## Preparing a Gradio app for Huggingface Spaces
|
| 19 |
+
|
| 20 |
+
Setup:
|
| 21 |
+
|
| 22 |
+
# Create a “safe” virtual Python environment
|
| 23 |
+
python3 -m venv env
|
| 24 |
+
# Install Gradio
|
| 25 |
+
pip3 install gradio
|
| 26 |
+
# Install optional packages for your specific app: pip3 install torch transformers
|
| 27 |
+
# Update the list of required packages
|
| 28 |
+
pip3 freeze > requirements.txt
|
| 29 |
+
# Create a blank app.py
|
| 30 |
+
touch app.py
|
| 31 |
+
|
| 32 |
+
Edit `app.py`, then run:
|
| 33 |
+
|
| 34 |
+
python3 app.py
|
| 35 |
+
|
| 36 |
+
and test your Gradio app on: http://127.0.0.1:7860/
|
| 37 |
+
|
| 38 |
## REST API via Gradio “Use via API” (see page footer)
|
| 39 |
|
| 40 |
curl -X POST -H 'Content-type: application/json' --data '{ "data": ["Wirwachs malmgård är en på 1770-talet uppförd egendom som ligger på västra Södermalm i Stockholm."] }' https://tomsoderlund-swedish-entity-recognition.hf.space/run/predict
|