Spaces:
Runtime error
Runtime error
add charts
Browse files- .ipynb_checkpoints/app-checkpoint.py +7 -4
- 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 |
-
|
| 28 |
-
|
| 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 |
-
|
| 28 |
-
|
| 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.')
|