karar-shah commited on
Commit
fe50ad7
Β·
1 Parent(s): 38bf7e6

Create pages/1_πŸ“ˆ_Sentiment_Plot.py

Browse files
Files changed (1) hide show
  1. pages/1_πŸ“ˆ_Sentiment_Plot.py +39 -0
pages/1_πŸ“ˆ_Sentiment_Plot.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import time
3
+ import numpy as np
4
+ import plotly.graph_objects as go
5
+
6
+
7
+ st.set_page_config(page_title="Plotting Demo", page_icon="πŸ“ˆ")
8
+
9
+
10
+ st.markdown("<h1><center>Plotting Emotion Sentiments</center></h1>",
11
+ unsafe_allow_html=True)
12
+ # st.sidebar.header("---")
13
+
14
+
15
+ if 'color' not in st.session_state:
16
+ st.session_state.colors = [
17
+ '#FF595E', '#323e5d', '#8AC926', '#ff9494', '#6A4C93', '#2A2B2D', '#F6AE2D']
18
+
19
+
20
+ # Create a bar chart
21
+ fig = go.Figure(data=[go.Bar(
22
+ x=list(st.session_state.emotion_counts.keys()),
23
+ y=list(st.session_state.emotion_counts.values()),
24
+ marker=dict(
25
+ color=st.session_state.colors
26
+ )
27
+ )])
28
+
29
+ # Update layout for better visualization and set figure size
30
+ fig.update_layout(
31
+ title='Emotion Counts',
32
+ xaxis=dict(title='Emotion Categories'),
33
+ yaxis=dict(title='Count'),
34
+ width=800, # Set the width of the figure
35
+ height=500 # Set the height of the figure
36
+
37
+ )
38
+
39
+ st.plotly_chart(fig, use_container_width=True)