hles67101 commited on
Commit
cca68a6
1 Parent(s): f934586

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ classifier = pipeline(task='text-classification', model='cwchang/my-text-classification-finetuned-v1', device=-1)
5
+
6
+ def classify(text):
7
+ return classifier(text)[0]["label"]
8
+
9
+ demo = 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
+
26
+ demo.launch()