File size: 533 Bytes
351080b
 
 
bbc083a
351080b
b99bfa0
 
 
351080b
 
 
8ed6974
 
bbc083a
351080b
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

pipeline = pipeline(task="text-classification", model="adelinamart/minilm_finetuned_emotions")

def predict(input):
    predictions = pipeline(input)
    return input, {p["label"]: p["score"] for p in predictions} 

gradio_app = gr.Interface(
    predict,
    inputs=gr.Textbox(lines=7, label="Info"),
    outputs=[gr.Textbox(label="Processed TEXT"), gr.Label(label="Result", num_top_classes=6)],
    title="Happy? Or Not?",
)

if __name__ == "__main__":
    gradio_app.launch()