Spaces:
Running
Running
Commit
·
d5e0d06
1
Parent(s):
9010788
Fix app graphs
Browse files
app.py
CHANGED
@@ -347,18 +347,23 @@ if (st.session_state.uploaded):
|
|
347 |
|
348 |
|
349 |
col_charts = st.columns(2)
|
|
|
|
|
350 |
with col_charts[0]:
|
351 |
fig_compare = go.Figure()
|
352 |
fig_compare.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Actual Sales'], mode='lines', name='Actual Sales'))
|
353 |
fig_compare.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Predicted Sales'], mode='lines', name='Predicted Sales'))
|
354 |
fig_compare.update_layout(title='Historical Sales Data', xaxis_title='Date', yaxis_title='Sales')
|
355 |
fig_compare.update_xaxes(range=['2020-01-01', '2025-01-01']) # TODO: Change this to be adaptive
|
|
|
356 |
st.plotly_chart(fig_compare, use_container_width=True)
|
|
|
357 |
with col_charts[1]:
|
358 |
fig_forecast = go.Figure()
|
359 |
-
|
360 |
-
|
361 |
-
|
|
|
362 |
st.plotly_chart(fig_compare, use_container_width=True)
|
363 |
st.write(f"MAPE score: {mape}% - {interpretation}")
|
364 |
|
@@ -366,6 +371,7 @@ if (st.session_state.uploaded):
|
|
366 |
with col_table[0]:
|
367 |
col_table[0].subheader(f"Forecasted sales in the next {period} days")
|
368 |
col_table[0].write(df)
|
|
|
369 |
with col_table[1]:
|
370 |
col_table[1] = st.subheader("Question-Answering")
|
371 |
with st.form("question_form"):
|
|
|
347 |
|
348 |
|
349 |
col_charts = st.columns(2)
|
350 |
+
min_date = merged_data[merged_data.columns[0]].min()
|
351 |
+
max_date = merged_data[merged_data.columns[0]].max()
|
352 |
with col_charts[0]:
|
353 |
fig_compare = go.Figure()
|
354 |
fig_compare.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Actual Sales'], mode='lines', name='Actual Sales'))
|
355 |
fig_compare.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Predicted Sales'], mode='lines', name='Predicted Sales'))
|
356 |
fig_compare.update_layout(title='Historical Sales Data', xaxis_title='Date', yaxis_title='Sales')
|
357 |
fig_compare.update_xaxes(range=['2020-01-01', '2025-01-01']) # TODO: Change this to be adaptive
|
358 |
+
fig_compare.update_xaxes(range=[min_date, max_date])
|
359 |
st.plotly_chart(fig_compare, use_container_width=True)
|
360 |
+
|
361 |
with col_charts[1]:
|
362 |
fig_forecast = go.Figure()
|
363 |
+
fig_forecast.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Actual Sales'], mode='lines', name='Actual Sales'))
|
364 |
+
fig_forecast.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Forecasted Future Sales'], mode='lines', name='Forecasted Future Sales'))
|
365 |
+
fig_forecast.update_layout(title='Forecasted Sales Data', xaxis_title='Date', yaxis_title='Sales')
|
366 |
+
fig_forecast.update_xaxes(range=[min_date, max_date])
|
367 |
st.plotly_chart(fig_compare, use_container_width=True)
|
368 |
st.write(f"MAPE score: {mape}% - {interpretation}")
|
369 |
|
|
|
371 |
with col_table[0]:
|
372 |
col_table[0].subheader(f"Forecasted sales in the next {period} days")
|
373 |
col_table[0].write(df)
|
374 |
+
|
375 |
with col_table[1]:
|
376 |
col_table[1] = st.subheader("Question-Answering")
|
377 |
with st.form("question_form"):
|