Spaces:
Runtime error
Runtime error
fathyshalab
commited on
Commit
•
d9321e0
1
Parent(s):
ba922c0
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,11 @@ token = os.environ["token"]
|
|
6 |
classifier = pipeline("zero-shot-classification",
|
7 |
model="joeddav/xlm-roberta-large-xnli",use_auth_token=token)
|
8 |
|
9 |
-
def classify(text):
|
10 |
-
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
gr.Interface(fn=classify, inputs="
|
|
|
6 |
classifier = pipeline("zero-shot-classification",
|
7 |
model="joeddav/xlm-roberta-large-xnli",use_auth_token=token)
|
8 |
|
9 |
+
def classify(text, intent_labels):
|
10 |
+
res = classifier(text, intent_labels)
|
11 |
+
results = {k: v for k, v in zip(res["labels"], res["scores"])}
|
12 |
+
return results
|
13 |
|
14 |
+
# input is two text boxes, one for the text and one for the labels
|
15 |
|
16 |
+
gr.Interface(fn=classify, inputs=["textbox", "textbox"], outputs="label").launch()
|