CoolFace
Apppublic

hles67101/text_classification_example

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
0likes
app.py26 linesDownload Raw Back to root
1import gradio as gr2from transformers import pipeline3 4classifier = pipeline(task='text-classification', model='cwchang/my-text-classification-finetuned-v1', device=-1)5 6def classify(text):7    return classifier(text)[0]["label"]8 9demo = gr.Interface(10    fn=classify,11    inputs=gr.Textbox(placeholder="Please enter the text..."),12    outputs="label",13    examples=[14        ["What's the weather like today?"],15        ["Set an alarm for 7 AM tomorrow"],16        ["Call Mom"],17        ["Send a text to Alex saying, 'I'll be there in 15 minutes'"],18        ["Play some relaxing music"],19        ["Remind me to buy milk when I'm at the grocery store"],20        ["How do I get to the nearest coffee shop?"],21        ["What's the latest news?"],22        ["Translate 'thank you' into Spanish"],23        ["Add a meeting to my calendar for next Monday at 3 PM"]]24    )25 26demo.launch()