fathyshalab commited on
Commit
4f77bf2
·
1 Parent(s): 0aa9bb7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,3 +1,11 @@
 
1
  import gradio as gr
 
 
2
 
3
- gr.Interface.load("models/joeddav/xlm-roberta-large-xnli",use_auth_token=True).launch()
 
 
 
 
 
 
1
+ from transformers import pipeline
2
  import gradio as gr
3
+ classifier = pipeline("zero-shot-classification",
4
+ model="joeddav/xlm-roberta-large-xnli",use_auth_token=True)
5
 
6
+ def classify(text):
7
+ return classifier(text, candidate_labels, multi_label=True)
8
+
9
+ candidate_labels = ["wasser", "strom", "gas", "hausreinigung", "schoenheit", "wellness", "oeffentlichkeit", "oeffentlicher", "verkehr", "vermietung", "medizin", "gesundheit", "pflege", "reisen", "tourismus", "versicherungen", "recht"]
10
+
11
+ gr.Interface(classify, "textbox", "label", live=True, capture_session=True).launch()