Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ from HebEMO import HebEMO
|
|
2 |
from transformers import pipeline
|
3 |
import streamlit as st
|
4 |
import matplotlib.pyplot as plt
|
|
|
5 |
|
6 |
|
7 |
HebEMO_model = HebEMO()
|
@@ -16,9 +17,19 @@ st.title("Find sentiment")
|
|
16 |
st.write("HebEMO is a tool to detect polarity and extract emotions from Hebrew user-generated content (UGC), which was trained on a unique Covid-19 related dataset that we collected and annotated. HebEMO yielded a high performance of weighted average F1-score = 0.96 for polarity classification. Emotion detection reached an F1-score of 0.78-0.97, with the exception of *surprise*, which the model failed to capture (F1 = 0.41). These results are better than the best-reported performance, even when compared to the English language.")
|
17 |
sent = st.text_area("Text", "write here", height = 20)
|
18 |
# interact(HebEMO_model.hebemo, text='讛讞讬讬诐 讬驻讬诐 讜诪讗讜砖专讬', plot=fixed(True), input_path=fixed(False), save_results=fixed(False),)
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
|
|
|
2 |
from transformers import pipeline
|
3 |
import streamlit as st
|
4 |
import matplotlib.pyplot as plt
|
5 |
+
import plotly.express as px
|
6 |
|
7 |
|
8 |
HebEMO_model = HebEMO()
|
|
|
17 |
st.write("HebEMO is a tool to detect polarity and extract emotions from Hebrew user-generated content (UGC), which was trained on a unique Covid-19 related dataset that we collected and annotated. HebEMO yielded a high performance of weighted average F1-score = 0.96 for polarity classification. Emotion detection reached an F1-score of 0.78-0.97, with the exception of *surprise*, which the model failed to capture (F1 = 0.41). These results are better than the best-reported performance, even when compared to the English language.")
|
18 |
sent = st.text_area("Text", "write here", height = 20)
|
19 |
# interact(HebEMO_model.hebemo, text='讛讞讬讬诐 讬驻讬诐 讜诪讗讜砖专讬', plot=fixed(True), input_path=fixed(False), save_results=fixed(False),)
|
20 |
+
hebEMO_df = HebEMO_model.hebemo(sent, plot=False)
|
21 |
+
hebEMO = pd.DataFrame()
|
22 |
+
for emo in hebEMO_df.columns[1::2]:
|
23 |
+
hebEMO[emo] = abs(hebEMO_df[emo]-(1-hebEMO_df['confidence_'+emo]))
|
24 |
+
|
25 |
+
|
26 |
+
fig = px.bar_polar(hebEMO.melt(), r="value", theta="variable",
|
27 |
+
color="variable",
|
28 |
+
template="ggplot2",
|
29 |
+
)
|
30 |
+
|
31 |
+
st.plotly_chart(fig, use_container_width=True)
|
32 |
+
st.write (hebEMO)
|
33 |
|
34 |
|
35 |
|