Download app.py from montoliu/testing: direct link, hf CLI and curl.
- Browser
- Download file 326 Bytes
-
https://huggingface.co/spaces/montoliu/testing/resolve/main/app.py
- Command line
-
hf download hf://spaces/montoliu/testing/app.py
-
curl -L -o app.py https://huggingface.co/spaces/montoliu/testing/resolve/main/app.py
326 Bytes
| from transformers import pipeline | |
| import gradio as gr | |
| classifier = pipeline("sentiment-analysis") | |
| def predict(prompt): | |
| result = classifier(prompt) | |
| label = result[0]["label"] | |
| score = result[0]["score"] | |
| return label + " " + str(score) | |
| gr.Interface(fn=predict, inputs="text", outputs="text").launch(share=True) |