Circhastic commited on
Commit
be97a09
β€’
1 Parent(s): ce66866

Update app

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -200,6 +200,7 @@ def get_converted_answer(table, query):
200
  st.title("Sales Forecasting Dashboard")
201
  st.write("πŸ“ˆ Welcome User, start using the application by uploading your file in the sidebar!")
202
 
 
203
  if 'uploaded' not in st.session_state:
204
  st.session_state.uploaded = False
205
 
@@ -297,6 +298,13 @@ if (st.session_state.uploaded):
297
  st.write("Forecasted sales in the next 3 months")
298
  st.write(df)
299
 
300
- question = st.text_input('Ask a Question about the Forecasted Data', placeholder="What is the total sales in the month of December?")
301
- answer = get_converted_answer(df, question)
302
- st.write('The answer for that is:', answer)
 
 
 
 
 
 
 
 
200
  st.title("Sales Forecasting Dashboard")
201
  st.write("πŸ“ˆ Welcome User, start using the application by uploading your file in the sidebar!")
202
 
203
+ # Session States
204
  if 'uploaded' not in st.session_state:
205
  st.session_state.uploaded = False
206
 
 
298
  st.write("Forecasted sales in the next 3 months")
299
  st.write(df)
300
 
301
+ with st.form("question_form"):
302
+ # Add a text input for the question
303
+ question = st.text_input('Ask a Question about the Forecasted Data', placeholder="What is the total sales in the month of December?")
304
+
305
+ # Add a button to submit the form
306
+ query_button = st.form_submit_button(label='Generate Answer')
307
+
308
+ if query_button:
309
+ answer = get_converted_answer(df, question)
310
+ st.write("The answer is:", answer)