Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
-
|
2 |
-
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = ['gun control', 'abortion', 'gender transition', 'freedom of speech', 'immigration', 'taxes']
|
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()
|