Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| import gradio as gr | |
| pipe = pipeline("text-classification", model="muhnatha/distilbert-base-uncased-game") | |
| def actor_game(emotion, text): | |
| pred_emotion = pipe(text) | |
| if pred_emotion[0]['label'] == emotion: | |
| return "YOU WON",emotion,pred_emotion[0]['label'] | |
| else: | |
| return "YOU LOSE",emotion,pred_emotion[0]['label'] | |
| iface = gr.Interface( | |
| fn=actor_game, | |
| inputs=[gr.Textbox(label="What emotion do you want to train?",placeholder = "joy, sadness, fear, surprise, love, anger"), | |
| gr.Textbox(label="your dialog")], | |
| outputs=[gr.Textbox(label="Result"),gr.Textbox(label="Expected"),gr.Textbox(label="your emotion")], | |
| title="Be an Actor", | |
| description="Type your dialog", | |
| ) | |
| iface.launch() |