Download app.py from wpms/ai: direct link, hf CLI and curl.
- Browser
- Download file 397 Bytes
-
https://huggingface.co/spaces/wpms/ai/resolve/main/app.py
- Command line
-
hf download hf://spaces/wpms/ai/app.py
-
curl -L -o app.py https://huggingface.co/spaces/wpms/ai/resolve/main/app.py
397 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| classifier = pipeline( | |
| "text-classification", | |
| model="distilbert-base-uncased-finetuned-sst-2-english" | |
| ) | |
| def predict(text): | |
| result = classifier(text)[0] | |
| return f"{result['label']} ({result['score']:.2f})" | |
| demo = gr.Interface( | |
| fn=predict, | |
| inputs="text", | |
| outputs="text", | |
| title="Simple AI Model" | |
| ) | |
| demo.launch() |