fathyshalab's picture
Update app.py
9b18155
raw
history blame
632 Bytes
from transformers import pipeline
import gradio as gr
import os
token = os.environ["token"]
classifier = pipeline("zero-shot-classification",
model="joeddav/xlm-roberta-large-xnli",use_auth_token=token)
def classify(text):
return classifier(text, candidate_labels, multi_label=True)
candidate_labels = ["wasser", "strom", "gas", "hausreinigung", "schoenheit", "wellness", "oeffentlichkeit", "oeffentlicher", "verkehr", "vermietung", "medizin", "gesundheit", "pflege", "reisen", "tourismus", "versicherungen", "recht"]
gr.Interface(classify, "textbox", "label", live=True, capture_session=True).launch()