Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,12 +26,12 @@ def sentiment(text, state):
|
|
| 26 |
if state == None:
|
| 27 |
state = []
|
| 28 |
state.append(res)
|
| 29 |
-
|
| 30 |
res_txt = [
|
| 31 |
f"{r['text']}: valence={r['valence']:0.3f}, arousal={r['arousal']:0.3f}, confidence=arousal={r['confidence']:0.3f}"
|
| 32 |
for r in state
|
| 33 |
]
|
| 34 |
-
return "\n".join(res_txt),
|
| 35 |
|
| 36 |
|
| 37 |
iface = gr.Interface(
|
|
@@ -39,6 +39,16 @@ iface = gr.Interface(
|
|
| 39 |
inputs=[gr.Textbox(lines=1, placeholder="Text for 3d sentiment..."), "state"],
|
| 40 |
outputs=[
|
| 41 |
gr.Textbox(lines=5, max_lines=5, label="Results"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
"state",
|
| 43 |
],
|
| 44 |
title=TITLE,
|
|
|
|
| 26 |
if state == None:
|
| 27 |
state = []
|
| 28 |
state.append(res)
|
| 29 |
+
df = pd.DataFrame(state)
|
| 30 |
res_txt = [
|
| 31 |
f"{r['text']}: valence={r['valence']:0.3f}, arousal={r['arousal']:0.3f}, confidence=arousal={r['confidence']:0.3f}"
|
| 32 |
for r in state
|
| 33 |
]
|
| 34 |
+
return "\n".join(res_txt), df, state
|
| 35 |
|
| 36 |
|
| 37 |
iface = gr.Interface(
|
|
|
|
| 39 |
inputs=[gr.Textbox(lines=1, placeholder="Text for 3d sentiment..."), "state"],
|
| 40 |
outputs=[
|
| 41 |
gr.Textbox(lines=5, max_lines=5, label="Results"),
|
| 42 |
+
gr.ScatterPlot(
|
| 43 |
+
x="valence",
|
| 44 |
+
y="arousal",
|
| 45 |
+
tooltip="text",
|
| 46 |
+
size="words",
|
| 47 |
+
size_legend_position="none",
|
| 48 |
+
interactive=False,
|
| 49 |
+
x_lim=[-1.05, 1.05],
|
| 50 |
+
y_lim=[-1.05, 1.05],
|
| 51 |
+
),
|
| 52 |
"state",
|
| 53 |
],
|
| 54 |
title=TITLE,
|