lg3394 commited on
Commit
7258dcc
·
verified ·
1 Parent(s): d53cef4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,7 +1,14 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ classifier = pipeline("zero-shot-classification",
5
+ model="facebook/bart-large-mnli")
6
 
7
+ def do_action(text):
8
+ candidate_labels = ['travel', 'cooking', 'dancing']
9
+ result = classifier(text, candidate_labels)
10
+
11
+ return result
12
+
13
+ iface = gr.Interface(fn=do_action, inputs="text", outputs="text")
14
+ iface.launch()