Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,8 @@ from transformers import pipeline
|
|
3 |
|
4 |
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7")
|
5 |
|
6 |
-
def classify(text,
|
7 |
-
labels =
|
8 |
if not text or not labels:
|
9 |
return []
|
10 |
result = classifier(text, candidate_labels=labels)
|
@@ -17,10 +17,7 @@ with gr.Blocks() as demo:
|
|
17 |
labels_input = gr.Textbox(label="Classes (comma separated)")
|
18 |
|
19 |
output = gr.Dataframe(headers=["Class", "Probability"], label="Classification Results")
|
20 |
-
|
21 |
-
def update_classes(classes):
|
22 |
-
return classes.split(',')
|
23 |
-
|
24 |
button = gr.Button("Classify")
|
25 |
|
26 |
button.click(classify, inputs=[text_input, labels_input], outputs=output)
|
|
|
3 |
|
4 |
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7")
|
5 |
|
6 |
+
def classify(text, labels):
|
7 |
+
labels = labels.split(',')
|
8 |
if not text or not labels:
|
9 |
return []
|
10 |
result = classifier(text, candidate_labels=labels)
|
|
|
17 |
labels_input = gr.Textbox(label="Classes (comma separated)")
|
18 |
|
19 |
output = gr.Dataframe(headers=["Class", "Probability"], label="Classification Results")
|
20 |
+
|
|
|
|
|
|
|
21 |
button = gr.Button("Classify")
|
22 |
|
23 |
button.click(classify, inputs=[text_input, labels_input], outputs=output)
|