CoolFace
Apppublic

Linkthat/IntentClassification

sourceHugging Faceupdated 4y agoView on Hugging Face
1likes
app.py17 linesDownload Raw Back to root
1from transformers import pipeline2import gradio as gr3import os4token = os.environ["token"]5 6classifier = pipeline("zero-shot-classification",7                      model="joeddav/xlm-roberta-large-xnli",use_auth_token=token)8 9def 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 results13 14# input is two text boxes, one for the text and one for the labels15 16gr.Interface(fn=classify, inputs=["textbox", "textbox"], outputs="label").launch()17