Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,3 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
-
import gradio as gr
|
3 |
-
import random
|
4 |
-
|
5 |
pipe = pipeline("text-classification", model="muhnatha/distilbert-base-uncased-game")
|
6 |
|
7 |
question = {
|
@@ -17,15 +13,15 @@ task = random.choice(list(question.items()))
|
|
17 |
def actor_game(text, emotion):
|
18 |
pred_emotion = pipe(text)
|
19 |
if pred_emotion[0]['label'] == emotion:
|
20 |
-
return "YOU WON"
|
21 |
else:
|
22 |
-
return "YOU LOSE"
|
23 |
|
24 |
iface = gr.Interface(
|
25 |
fn=actor_game,
|
26 |
-
inputs=[gr.Textbox(label=
|
27 |
gr.Textbox(task[0],visible=False)],
|
28 |
-
outputs=[gr.Textbox(label=
|
29 |
title="Be an Actor",
|
30 |
description="Type your dialog",
|
31 |
)
|
|
|
|
|
|
|
|
|
|
|
1 |
pipe = pipeline("text-classification", model="muhnatha/distilbert-base-uncased-game")
|
2 |
|
3 |
question = {
|
|
|
13 |
def actor_game(text, emotion):
|
14 |
pred_emotion = pipe(text)
|
15 |
if pred_emotion[0]['label'] == emotion:
|
16 |
+
return "YOU WON",emotion,pred_emotion[0]['label']
|
17 |
else:
|
18 |
+
return "YOU LOSE",emotion,pred_emotion[0]['label']
|
19 |
|
20 |
iface = gr.Interface(
|
21 |
fn=actor_game,
|
22 |
+
inputs=[gr.Textbox(label=task[1]),
|
23 |
gr.Textbox(task[0],visible=False)],
|
24 |
+
outputs=[gr.Textbox(label="Result"),gr.Textbox(label="Expected"),gr.Textbox(label="your emotion")],
|
25 |
title="Be an Actor",
|
26 |
description="Type your dialog",
|
27 |
)
|