Kr08 commited on
Commit
7057428
·
verified ·
1 Parent(s): 3dcbbec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  from config import index_options, time_intervals, START_DATE, END_DATE, FORECAST_PERIOD
3
  from data_fetcher import get_stocks_from_index
4
  from stock_analysis import get_stock_graph_and_info
@@ -11,11 +12,15 @@ with demo:
11
  d3 = gr.Dropdown(time_intervals, label='Select Time Interval', value='1d', interactive=True)
12
  d4 = gr.Radio(['Line Graph', 'Candlestick Graph'], label='Select Graph Type', value='Line Graph', interactive=True)
13
  d5 = gr.Dropdown(['ARIMA', 'Prophet', 'LSTM'], label='Select Forecasting Method', value='ARIMA', interactive=True)
 
 
 
 
14
 
15
  out_graph = gr.Plot()
16
  out_fundamentals = gr.DataFrame()
17
 
18
- inputs = [d1, d2, d3, d4, d5]
19
  outputs = [out_graph, out_fundamentals]
20
 
21
  def update_stock_options(index):
@@ -27,6 +32,8 @@ with demo:
27
  d3.change(get_stock_graph_and_info, inputs, outputs)
28
  d4.change(get_stock_graph_and_info, inputs, outputs)
29
  d5.change(get_stock_graph_and_info, inputs, outputs)
 
 
30
 
31
  if __name__ == "__main__":
32
  demo.launch()
 
1
  import gradio as gr
2
+ from datetime import date, timedelta
3
  from config import index_options, time_intervals, START_DATE, END_DATE, FORECAST_PERIOD
4
  from data_fetcher import get_stocks_from_index
5
  from stock_analysis import get_stock_graph_and_info
 
12
  d3 = gr.Dropdown(time_intervals, label='Select Time Interval', value='1d', interactive=True)
13
  d4 = gr.Radio(['Line Graph', 'Candlestick Graph'], label='Select Graph Type', value='Line Graph', interactive=True)
14
  d5 = gr.Dropdown(['ARIMA', 'Prophet', 'LSTM'], label='Select Forecasting Method', value='ARIMA', interactive=True)
15
+
16
+ # New date inputs
17
+ date_start = gr.Date(label="Start Date", value=START_DATE)
18
+ date_end = gr.Date(label="End Date", value=END_DATE)
19
 
20
  out_graph = gr.Plot()
21
  out_fundamentals = gr.DataFrame()
22
 
23
+ inputs = [d1, d2, d3, d4, d5, date_start, date_end]
24
  outputs = [out_graph, out_fundamentals]
25
 
26
  def update_stock_options(index):
 
32
  d3.change(get_stock_graph_and_info, inputs, outputs)
33
  d4.change(get_stock_graph_and_info, inputs, outputs)
34
  d5.change(get_stock_graph_and_info, inputs, outputs)
35
+ date_start.change(get_stock_graph_and_info, inputs, outputs)
36
+ date_end.change(get_stock_graph_and_info, inputs, outputs)
37
 
38
  if __name__ == "__main__":
39
  demo.launch()