import gradio as gr from transformers import pipeline model = pipeline( "text-classification", model="TropicalBee/talk2self-emotion-detection" ) def predict(text): results = model(text, top_k=None) return {r["label"]: r["score"] for r in results} demo = gr.Interface( fn=predict, inputs=gr.Textbox(placeholder="Type how you're feeling..."), outputs=gr.Label(num_top_classes=7), title="Talk2Self Emotion Detection" ) demo.launch(server_name="0.0.0.0", server_port=7860,ssr_mode=False)