File size: 1,807 Bytes
53f1934
9073835
 
6bb7168
24c0e03
dd1a5fd
6bb7168
9073835
4b236a5
53f0238
53f1934
 
31e225c
3124894
b71aa52
31e225c
3124894
0ef2ca5
dd1a5fd
82fae2a
2b8e801
 
 
 
dd1a5fd
2b8e801
b0caf30
 
 
 
4429686
 
 
 
2b8e801
4429686
2522810
 
53f1934
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from HebEMO import HebEMO
from transformers import pipeline
import streamlit as st
import matplotlib.pyplot as plt
import pandas as pd
from spider_plot import spider_plot


# @st.cache
HebEMO_model = HebEMO()


st.title("Emotion Recognition in Hebrew Texts")
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). More information can be found in our git: https://github.com/avichaychriqui/HeBERT")
st.write("Write Hebrew sentences in the text box below to analyze (each sentence in a different rew). It takes a while, be patient :). An additional demo can be found in the Colab notebook: https://colab.research.google.com/drive/1Jw3gOWjwVMcZslu-ttXoNeD17lms1-ff ")

sent = st.text_area("Text", "ื”ื—ื™ื™ื ื™ืคื™ื ื•ืžืื•ืฉืจื™ื", height = 20)
# interact(HebEMO_model.hebemo, text='ื”ื—ื™ื™ื ื™ืคื™ื ื•ืžืื•ืฉืจื™', plot=fixed(True), input_path=fixed(False), save_results=fixed(False),)

hebEMO_df = HebEMO_model.hebemo(sent, read_lines=True, plot=False)
hebEMO = pd.DataFrame()
for emo in hebEMO_df.columns[1::2]:
    hebEMO[emo] = abs(hebEMO_df[emo]-(1-hebEMO_df['confidence_'+emo]))

st.write (hebEMO)

# plot= st.checkbox('Plot?')
# if plot:
#     ax = spider_plot(hebEMO)
#    st.pyplot(ax)
# fig = px.bar_polar(hebEMO.melt(), r="value", theta="variable",
#                       color="variable", 
#                       template="ggplot2",
#                      )

# st.plotly_chart(fig, use_container_width=True)