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