File size: 499 Bytes
93643d5
d04fba3
 
 
6deae7c
d04fba3
 
 
5071704
93643d5
 
d04fba3
 
93643d5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio
from transformers import pipeline

def zero_shot_classification(data):
    classifier = pipeline('zero-shot-classification', model='Xenova/mobilebert-uncased-mnli')

    results = classifier(data.sequence, candidate_labels=data.candidate_labels, hypothesis_template=data.hypothesis_template, multi_label=data.multi_label)
    return {results}

gradio_interface = gradio.Interface(
    fn = zero_shot_classification,
    inputs = "json",
    outputs = "json"
)
gradio_interface.launch()