avichr commited on
Commit
dd1a5fd
โ€ข
1 Parent(s): f2fdbae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -3,7 +3,7 @@ from transformers import pipeline
3
  import streamlit as st
4
  import matplotlib.pyplot as plt
5
  import pandas as pd
6
- # import plotly.express as px
7
 
8
 
9
  # @st.cache
@@ -19,19 +19,24 @@ st.title("Find sentiment")
19
  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.")
20
  sent = st.text_area("Text", "write here", height = 20)
21
  # interact(HebEMO_model.hebemo, text='ื”ื—ื™ื™ื ื™ืคื™ื ื•ืžืื•ืฉืจื™', plot=fixed(True), input_path=fixed(False), save_results=fixed(False),)
22
- hebEMO_df = HebEMO_model.hebemo(sent, plot=False)
 
23
  hebEMO = pd.DataFrame()
24
  for emo in hebEMO_df.columns[1::2]:
25
  hebEMO[emo] = abs(hebEMO_df[emo]-(1-hebEMO_df['confidence_'+emo]))
26
 
 
27
 
 
 
 
 
28
  # fig = px.bar_polar(hebEMO.melt(), r="value", theta="variable",
29
  # color="variable",
30
  # template="ggplot2",
31
  # )
32
 
33
  # st.plotly_chart(fig, use_container_width=True)
34
- st.write (hebEMO)
35
 
36
 
37
 
 
3
  import streamlit as st
4
  import matplotlib.pyplot as plt
5
  import pandas as pd
6
+ from spider_plot import spider_plot
7
 
8
 
9
  # @st.cache
 
19
  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.")
20
  sent = st.text_area("Text", "write here", height = 20)
21
  # interact(HebEMO_model.hebemo, text='ื”ื—ื™ื™ื ื™ืคื™ื ื•ืžืื•ืฉืจื™', plot=fixed(True), input_path=fixed(False), save_results=fixed(False),)
22
+
23
+ hebEMO_df = HebEMO_model.hebemo(sent, read_lines=True plot=False)
24
  hebEMO = pd.DataFrame()
25
  for emo in hebEMO_df.columns[1::2]:
26
  hebEMO[emo] = abs(hebEMO_df[emo]-(1-hebEMO_df['confidence_'+emo]))
27
 
28
+ st.write (hebEMO)
29
 
30
+ plot= st.checkbox('Plot?')
31
+ if plot:
32
+ ax = spider_plot(hebEMO)
33
+ st.pyplot(ax)
34
  # fig = px.bar_polar(hebEMO.melt(), r="value", theta="variable",
35
  # color="variable",
36
  # template="ggplot2",
37
  # )
38
 
39
  # st.plotly_chart(fig, use_container_width=True)
 
40
 
41
 
42