Download app.py from gau2345/hostingamazonmodelgradiomymodel1: direct link, hf CLI and curl.
- Browser
- Download file 599 Bytes
-
https://huggingface.co/spaces/gau2345/hostingamazonmodelgradiomymodel1/resolve/main/app.py
- Command line
-
hf download hf://spaces/gau2345/hostingamazonmodelgradiomymodel1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/gau2345/hostingamazonmodelgradiomymodel1/resolve/main/app.py
599 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| MODEL_ID = "gau2345/autotrain-bk2rf-3sf1s" # your fine-tuned model repo | |
| clf = pipeline("text-classification", model=MODEL_ID) | |
| def predict(text): | |
| out = clf(text, truncation=True) | |
| # Return as label→score dict for a nice probability bar | |
| return {r["label"]: float(r["score"]) for r in out} | |
| gr.Interface( | |
| fn=predict, | |
| inputs=gr.Textbox(lines=3, label="Customer message"), | |
| outputs=gr.Label(num_top_classes=5), | |
| title="Amazon Intent Classifier", | |
| description="Paste a customer message to classify intent." | |
| ).launch() | |