HebEMO_demo / app.py
avichr's picture
Update app.py
24c0e03
raw
history blame
1.47 kB
from HebEMO import HebEMO
from transformers import pipeline
import streamlit as st
import matplotlib.pyplot as plt
import pandas as pd
# import plotly.express as px
# @st.cache
HebEMO_model = HebEMO()
x = st.slider("Select a value")
st.write(x, "squared is", x * x)
st.title("Find sentiment")
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.")
sent = st.text_area("Text", "write here", height = 20)
# interact(HebEMO_model.hebemo, text='ื”ื—ื™ื™ื ื™ืคื™ื ื•ืžืื•ืฉืจื™', plot=fixed(True), input_path=fixed(False), save_results=fixed(False),)
hebEMO_df = HebEMO_model.hebemo(sent, plot=False)
hebEMO = pd.DataFrame()
for emo in hebEMO_df.columns[1::2]:
hebEMO[emo] = abs(hebEMO_df[emo]-(1-hebEMO_df['confidence_'+emo]))
# fig = px.bar_polar(hebEMO.melt(), r="value", theta="variable",
# color="variable",
# template="ggplot2",
# )
# st.plotly_chart(fig, use_container_width=True)
st.write (hebEMO)