Spaces:
Runtime error
Runtime error
Commit
·
26b285e
1
Parent(s):
37dac63
Fix bar plot
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ def classify_text(text: str) -> Dict[str, float]:
|
|
| 38 |
outputs = torch.softmax(outputs.logits, dim=1)
|
| 39 |
outputs = outputs[:, 1]
|
| 40 |
score = outputs.detach().cpu().numpy()[0]
|
| 41 |
-
scores.append([foundation.capitalize, score])
|
| 42 |
scores = pd.DataFrame(scores, columns=["foundation", "score"])
|
| 43 |
return scores
|
| 44 |
|
|
@@ -52,7 +52,7 @@ demo = gr.Interface(
|
|
| 52 |
container=False,
|
| 53 |
show_label=True,
|
| 54 |
placeholder="Enter some text...",
|
| 55 |
-
lines=
|
| 56 |
scale=10,
|
| 57 |
),
|
| 58 |
],
|
|
@@ -61,9 +61,12 @@ demo = gr.Interface(
|
|
| 61 |
x="foundation",
|
| 62 |
y="score",
|
| 63 |
title="Moral foundations scores",
|
| 64 |
-
x_title="
|
| 65 |
-
y_title="
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
| 67 |
)
|
| 68 |
],
|
| 69 |
)
|
|
|
|
| 38 |
outputs = torch.softmax(outputs.logits, dim=1)
|
| 39 |
outputs = outputs[:, 1]
|
| 40 |
score = outputs.detach().cpu().numpy()[0]
|
| 41 |
+
scores.append([foundation.capitalize(), score])
|
| 42 |
scores = pd.DataFrame(scores, columns=["foundation", "score"])
|
| 43 |
return scores
|
| 44 |
|
|
|
|
| 52 |
container=False,
|
| 53 |
show_label=True,
|
| 54 |
placeholder="Enter some text...",
|
| 55 |
+
lines=12,
|
| 56 |
scale=10,
|
| 57 |
),
|
| 58 |
],
|
|
|
|
| 61 |
x="foundation",
|
| 62 |
y="score",
|
| 63 |
title="Moral foundations scores",
|
| 64 |
+
x_title=" ",
|
| 65 |
+
y_title=" ",
|
| 66 |
+
y_lim=[0, 1],
|
| 67 |
+
vertical=False,
|
| 68 |
+
height=200,
|
| 69 |
+
width=500,
|
| 70 |
)
|
| 71 |
],
|
| 72 |
)
|