hongaik commited on
Commit
5145430
1 Parent(s): c19c9f8

add charts

Browse files
Files changed (2) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +7 -4
  2. app.py +7 -4
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  import plotly.express as px
 
3
  from utils import *
4
 
5
  ########## Title for the Web App ##########
@@ -18,15 +19,17 @@ if st.button('Click for predictions!'):
18
  pie = px.pie(sentiment_prob,
19
  values='probability',
20
  names='sentiment',
21
- title='Sentiment Probability',
22
  color_discrete_map={'positive':'rgb(0, 204, 0)',
23
  'negative':'rgb(215, 11, 11)'
24
  },
25
  color='sentiment'
26
  )
27
- st.plotly_chart(bar, use_container_width=True)
28
- st.plotly_chart(pie, use_container_width=True)
29
-
 
 
 
30
 
31
  st.write("\n")
32
  st.subheader('Or... Upload a csv file if you have a file instead.')
 
1
  import streamlit as st
2
  import plotly.express as px
3
+ from plotly.subplots import make_subplots
4
  from utils import *
5
 
6
  ########## Title for the Web App ##########
 
19
  pie = px.pie(sentiment_prob,
20
  values='probability',
21
  names='sentiment',
 
22
  color_discrete_map={'positive':'rgb(0, 204, 0)',
23
  'negative':'rgb(215, 11, 11)'
24
  },
25
  color='sentiment'
26
  )
27
+
28
+ fig = make_subplots(rows=1, cols=2)
29
+ fig.add_trace(bar, row=1, col=1)
30
+ fig.add_trace(pie, row=1, col=2)
31
+
32
+ st.plotly_chart(fig, use_container_width=True)
33
 
34
  st.write("\n")
35
  st.subheader('Or... Upload a csv file if you have a file instead.')
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  import plotly.express as px
 
3
  from utils import *
4
 
5
  ########## Title for the Web App ##########
@@ -18,15 +19,17 @@ if st.button('Click for predictions!'):
18
  pie = px.pie(sentiment_prob,
19
  values='probability',
20
  names='sentiment',
21
- title='Sentiment Probability',
22
  color_discrete_map={'positive':'rgb(0, 204, 0)',
23
  'negative':'rgb(215, 11, 11)'
24
  },
25
  color='sentiment'
26
  )
27
- st.plotly_chart(bar, use_container_width=True)
28
- st.plotly_chart(pie, use_container_width=True)
29
-
 
 
 
30
 
31
  st.write("\n")
32
  st.subheader('Or... Upload a csv file if you have a file instead.')
 
1
  import streamlit as st
2
  import plotly.express as px
3
+ from plotly.subplots import make_subplots
4
  from utils import *
5
 
6
  ########## Title for the Web App ##########
 
19
  pie = px.pie(sentiment_prob,
20
  values='probability',
21
  names='sentiment',
 
22
  color_discrete_map={'positive':'rgb(0, 204, 0)',
23
  'negative':'rgb(215, 11, 11)'
24
  },
25
  color='sentiment'
26
  )
27
+
28
+ fig = make_subplots(rows=1, cols=2)
29
+ fig.add_trace(bar, row=1, col=1)
30
+ fig.add_trace(pie, row=1, col=2)
31
+
32
+ st.plotly_chart(fig, use_container_width=True)
33
 
34
  st.write("\n")
35
  st.subheader('Or... Upload a csv file if you have a file instead.')