-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
23 lines (20 loc) · 838 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import streamlit as st
import pandas as pd
import numpy as np
from functions import *
import matplotlib.pyplot as plt
import plotly.express as px
cols = ['c','m','r','b', 'g']
labels=['Happy', 'Angry', 'Surprise', 'Sad', 'Fear']
st.title('Emotion Analyzer')
sentence = st.text_area('Input your sentence here:')
if st.button("submit"):
if sentence:
emotions = get_emotion(sentence)
st.write(emotions)
fig = px.pie(values= list(emotions.values()), names= list(emotions.keys()), title="Emotion's Percentage")
if sum(list(emotions.values())) is not 0:
st.plotly_chart(fig)