Spaces:
Runtime error
Runtime error
changed loading text on spiners and ordered results
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import plotly.express as px
|
|
4 |
import pandas as pd
|
5 |
|
6 |
st.title("Phrase Feeling Analysis")
|
7 |
-
with st.spinner():
|
8 |
classifier = t.pipeline("zero-shot-classification",
|
9 |
model="facebook/bart-large-mnli",
|
10 |
multi_class=True)
|
@@ -15,11 +15,16 @@ candidate_labels = ['anger', 'sadness', 'fear', 'joy', 'interest',
|
|
15 |
|
16 |
if x != "":
|
17 |
|
18 |
-
with st.spinner():
|
19 |
output = classifier(x, candidate_labels)
|
20 |
# st.write(str(output))
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
23 |
fig = px.line_polar(df, r='r', theta='theta', line_close=True)
|
24 |
fig.update_traces(fill='toself')
|
25 |
|
|
|
4 |
import pandas as pd
|
5 |
|
6 |
st.title("Phrase Feeling Analysis")
|
7 |
+
with st.spinner(text="Loading model..."):
|
8 |
classifier = t.pipeline("zero-shot-classification",
|
9 |
model="facebook/bart-large-mnli",
|
10 |
multi_class=True)
|
|
|
15 |
|
16 |
if x != "":
|
17 |
|
18 |
+
with st.spinner(text="Evaluating your input..."):
|
19 |
output = classifier(x, candidate_labels)
|
20 |
# st.write(str(output))
|
21 |
|
22 |
+
ordered_results = []
|
23 |
+
for lbl in candidate_labels:
|
24 |
+
ind = output['labels'].index(lbl)
|
25 |
+
correct_order.append(output['scores'][ind])
|
26 |
+
|
27 |
+
df = pd.DataFrame(dict(r=ordered_results, theta=candidate_labels))
|
28 |
fig = px.line_polar(df, r='r', theta='theta', line_close=True)
|
29 |
fig.update_traces(fill='toself')
|
30 |
|