Kr08's picture
Update app.py
5b5151c verified
raw
history blame
1.26 kB
import gradio as gr
from config import index_options, time_intervals, START_DATE, END_DATE, FORECAST_PERIOD
from data_fetcher import get_stocks_from_index
from stock_analysis import get_stock_graph_and_info
demo = gr.Blocks()
with demo:
d1 = gr.Dropdown(index_options, label='Please select Index...', info='Will be adding more indices later on', interactive=True)
d2 = gr.Dropdown([], label='Please Select Stock from your selected index', interactive=True)
d3 = gr.Dropdown(time_intervals, label='Select Time Interval', value='1d', interactive=True)
d4 = gr.Radio(['Line Graph', 'Candlestick Graph'], label='Select Graph Type', value='Line Graph', interactive=True)
d5 = gr.Dropdown(['ARIMA', 'Prophet', 'LSTM'], label='Select Forecasting Method', value='ARIMA', interactive=True)
out_graph = gr.Plot()
out_fundamentals = gr.DataFrame()
inputs = [d1, d2, d3, d4, d5]
outputs = [out_graph, out_fundamentals]
d1.input(get_stocks_from_index, d1, d2)
d2.input(get_stock_graph_and_info, inputs, outputs)
d3.input(get_stock_graph_and_info, inputs, outputs)
d4.input(get_stock_graph_and_info, inputs, outputs)
d5.input(get_stock_graph_and_info, inputs, outputs)
if __name__ == "__main__":
demo.launch()