Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as grad
|
3 |
+
zero_shot_classifier = pipeline("zero-shot-classification")
|
4 |
+
def classify(text,labels):
|
5 |
+
classifer_labels = labels.split(",")
|
6 |
+
#["software", "politics", "love", "movies", "emergency",
|
7 |
+
"advertisment","sports"]
|
8 |
+
response = zero_shot_classifier(text,classifer_labels)
|
9 |
+
return response
|
10 |
+
txt=grad.Textbox(lines=1, label="English", placeholder="text to be classified")
|
11 |
+
labels=grad.Textbox(lines=1, label="Labels", placeholder="comma separated labels")
|
12 |
+
out=grad.Textbox(lines=1, label="Classification")
|
13 |
+
grad.Interface(classify, inputs=[txt,labels], outputs=out).launch()
|