Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as grad
|
| 3 |
+
|
| 4 |
+
zero_shot_cls = pipeline("zero-shot-classification")
|
| 5 |
+
|
| 6 |
+
def classify(text, labels):
|
| 7 |
+
cls_labels = labels.split(",")
|
| 8 |
+
|
| 9 |
+
#["IT", "software", "marketing", "sales", "R&D", "logistics"]
|
| 10 |
+
response = zero_shot_cls(text, cls_labels)
|
| 11 |
+
return response
|
| 12 |
+
|
| 13 |
+
in_text = grad.Textbox(lines=1, label="English", placeholder="Text to be classified")
|
| 14 |
+
in_labels = grad.Textbox(lines=1, label="Labels", placeholder="Comma separated labels")
|
| 15 |
+
out = grad.Textbox(lines=1, iputs=[in_text, in_labels], outputs=out).launch()
|