Circhastic commited on
Commit
707f8be
1 Parent(s): f70d90f

Version 1 hotfix #31 for merge

Browse files
Files changed (1) hide show
  1. app.py +22 -23
app.py CHANGED
@@ -343,36 +343,35 @@ if (st.session_state.uploaded):
343
  test_y, predictions = np.array(test_y), np.array(fitted)
344
  score = forecast_accuracy(predictions, test_y)
345
  mape, interpretation = interpret_mape(score['mape'])
 
 
 
 
 
 
 
 
 
 
 
346
 
347
  col = st.columns(2)
348
  with col[0]:
349
- merged_data = merge_forecast_data(df['Sales'], fitted_series, future_fitted_series)
350
-
351
- fig = go.Figure()
352
- fig.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=df['Sales'], mode='lines', name='Actual Sales'))
353
- fig.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Predicted Sales'], mode='lines', name='Predicted Sales'))
354
- fig.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Forecasted Future Sales'], mode='lines', name='Forecasted Future Sales'))
355
- fig.update_layout(title='Forecasted Sales Data', xaxis_title='Date', yaxis_title='Sales')
356
- fig.update_xaxes(range=['2020-01-01', '2025-01-01']) # TODO: Change this to be adaptive
357
- col[0].plotly_chart(fig)
358
- col[0].write(f"MAPE score: {mape}% - {interpretation}")
359
  with col[1]:
360
- col[1].subheader(f"Forecasted sales in the next {period} days")
361
- col[1].write(df)
 
 
 
 
 
 
 
362
  st.session_state.forecasted = True
363
 
364
 
365
- with st.form("question_form"):
366
- question = st.text_input('Ask a Question about the Forecasted Data', placeholder="What is the total sales in the month of December?")
367
- query_button = st.form_submit_button(label='Generate Answer')
368
-
369
- if query_button or question:
370
- answer = get_converted_answer(df, question)
371
- if answer is not None:
372
- st.subheader("The answer is:", answer)
373
- else:
374
- st.subheader("Answer is not found in table")
375
-
376
  # Hide Streamlit default style
377
  hide_st_style = """
378
  <style>
 
343
  test_y, predictions = np.array(test_y), np.array(fitted)
344
  score = forecast_accuracy(predictions, test_y)
345
  mape, interpretation = interpret_mape(score['mape'])
346
+
347
+ merged_data = merge_forecast_data(df['Sales'], fitted_series, future_fitted_series)
348
+
349
+ fig = go.Figure()
350
+ fig.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Actual Sales'], mode='lines', name='Actual Sales'))
351
+ fig.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Predicted Sales'], mode='lines', name='Predicted Sales'))
352
+ fig.add_trace(go.Scatter(x=merged_data[merged_data.columns[0]], y=merged_data['Forecasted Future Sales'], mode='lines', name='Forecasted Future Sales'))
353
+ fig.update_layout(title='Forecasted Sales Data', xaxis_title='Date', yaxis_title='Sales')
354
+ fig.update_xaxes(range=['2020-01-01', '2025-01-01']) # TODO: Change this to be adaptive
355
+ st.plotly_chart(fig)
356
+ st.write(f"MAPE score: {mape}% - {interpretation}")
357
 
358
  col = st.columns(2)
359
  with col[0]:
360
+ col[0].subheader(f"Forecasted sales in the next {period} days")
361
+ col[0].write(df)
 
 
 
 
 
 
 
 
362
  with col[1]:
363
+ with st.form("question_form"):
364
+ question = col[1].text_input('Ask a Question about the Forecasted Data', placeholder="What is the total sales in the month of December?")
365
+ query_button = col[1].form_submit_button(label='Generate Answer')
366
+ if query_button or question:
367
+ answer = get_converted_answer(df, question)
368
+ if answer is not None:
369
+ col[1].subheader("The answer is:", answer)
370
+ else:
371
+ col[1].subheader("Answer is not found in table")
372
  st.session_state.forecasted = True
373
 
374
 
 
 
 
 
 
 
 
 
 
 
 
375
  # Hide Streamlit default style
376
  hide_st_style = """
377
  <style>