Commit
·
5d00e2d
1
Parent(s):
31a7455
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
def greet(
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
def greet(text):
|
| 5 |
+
classifier = pipeline("zero-shot-classification",
|
| 6 |
+
model="facebook/bart-large-mnli")
|
| 7 |
+
|
| 8 |
+
candidate_labels = ['travel', 'cooking', 'dancing']
|
| 9 |
+
result = classifier(text, candidate_labels)
|
| 10 |
+
|
| 11 |
+
return result
|
| 12 |
|
| 13 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 14 |
iface.launch()
|