Spaces:
Runtime error
Runtime error
added plotly_chart to frontend
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import transformers as t
|
3 |
-
import plotly.
|
|
|
4 |
|
5 |
st.title("Phrase Feeling Analysis")
|
6 |
classifier = t.pipeline("zero-shot-classification",
|
@@ -13,17 +14,8 @@ candidate_labels = ['anger', 'sadness', 'fear', 'joy', 'interest',
|
|
13 |
output = classifier(x, candidate_labels)
|
14 |
st.write(str(output))
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
# fill='toself'
|
20 |
-
# ))
|
21 |
|
22 |
-
|
23 |
-
# polar=dict(
|
24 |
-
# radialaxis=dict(
|
25 |
-
# visible=True
|
26 |
-
# ),
|
27 |
-
# ),
|
28 |
-
# showlegend=False
|
29 |
-
# )
|
|
|
1 |
import streamlit as st
|
2 |
import transformers as t
|
3 |
+
import plotly.express as px
|
4 |
+
import pandas as pd
|
5 |
|
6 |
st.title("Phrase Feeling Analysis")
|
7 |
classifier = t.pipeline("zero-shot-classification",
|
|
|
14 |
output = classifier(x, candidate_labels)
|
15 |
st.write(str(output))
|
16 |
|
17 |
+
df = pd.DataFrame(dict(r=output['scores'], theta=output['labels']))
|
18 |
+
fig = px.line_polar(df, r='r', theta='theta', line_close=True)
|
19 |
+
fig.update_traces(fill='toself')
|
|
|
|
|
20 |
|
21 |
+
st.plotly_chart(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|