File size: 877 Bytes
cca68a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()