Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ demo = gr.Blocks()
|
|
| 7 |
|
| 8 |
with demo:
|
| 9 |
d1 = gr.Dropdown(index_options, label='Please select Index...', info='Will be adding more indices later on', interactive=True)
|
| 10 |
-
d2 = gr.Dropdown(
|
| 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)
|
|
@@ -18,11 +18,15 @@ with demo:
|
|
| 18 |
inputs = [d1, d2, d3, d4, d5]
|
| 19 |
outputs = [out_graph, out_fundamentals]
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
if __name__ == "__main__":
|
| 28 |
demo.launch()
|
|
|
|
| 7 |
|
| 8 |
with demo:
|
| 9 |
d1 = gr.Dropdown(index_options, label='Please select Index...', info='Will be adding more indices later on', interactive=True)
|
| 10 |
+
d2 = gr.Dropdown(label='Please Select Stock from your selected index', interactive=True)
|
| 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)
|
|
|
|
| 18 |
inputs = [d1, d2, d3, d4, d5]
|
| 19 |
outputs = [out_graph, out_fundamentals]
|
| 20 |
|
| 21 |
+
def update_stock_options(index):
|
| 22 |
+
stocks = get_stocks_from_index(index)
|
| 23 |
+
return gr.Dropdown(choices=stocks)
|
| 24 |
+
|
| 25 |
+
d1.change(update_stock_options, d1, d2)
|
| 26 |
+
d2.change(get_stock_graph_and_info, inputs, outputs)
|
| 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()
|