|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
classifier = pipeline(task='text-classification', model='cwchang/my-text-classification-finetuned-v1', device=-1) |
|
|
|
def classify(text): |
|
return classifier(text)[0]["label"] |
|
|
|
demo = gr.Interface( |
|
fn=classify, |
|
inputs=gr.Textbox(placeholder="Please enter the text..."), |
|
outputs="label", |
|
examples=[ |
|
["What's the weather like today?"], |
|
["Set an alarm for 7 AM tomorrow"], |
|
["Call Mom"], |
|
["Send a text to Alex saying, 'I'll be there in 15 minutes'"], |
|
["Play some relaxing music"], |
|
["Remind me to buy milk when I'm at the grocery store"], |
|
["How do I get to the nearest coffee shop?"], |
|
["What's the latest news?"], |
|
["Translate 'thank you' into Spanish"], |
|
["Add a meeting to my calendar for next Monday at 3 PM"]] |
|
) |
|
|
|
demo.launch() |