aromidvar commited on
Commit
33fef3a
·
verified ·
1 Parent(s): 87760cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -2
app.py CHANGED
@@ -93,5 +93,36 @@ def gradio_ui():
93
  response = requests.post(f'http://localhost:5000/search', json={'query': query})
94
  return response.json()
95
 
96
- def call
97
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  response = requests.post(f'http://localhost:5000/search', json={'query': query})
94
  return response.json()
95
 
96
+ def call_predict(num_predictions):
97
+ response = requests.post(f'http://localhost:5000/predict', json={'num_predictions': num_predictions})
98
+ return response.json()
99
+
100
+ def call_economic_data():
101
+ response = requests.get('http://localhost:5000/economic_data')
102
+ return response.json()
103
+
104
+ with gr.Blocks() as demo:
105
+ gr.Markdown("# Economic DataHub")
106
+ gr.Markdown("Welcome to the interactive Economic DataHub. Explore economic indicators, make predictions, and access detailed economic data.")
107
+
108
+ with gr.Tab("Search Economic Indicators"):
109
+ search_input = gr.Textbox(label="Search for Economic Terms:", placeholder="Enter an economic term...")
110
+ search_button = gr.Button("Search")
111
+ search_output = gr.Textbox(label="Results", interactive=False)
112
+
113
+ search_button.click(call_search, inputs=search_input, outputs=search_output)
114
+
115
+ with gr.Tab("Time Series Prediction"):
116
+ num_predictions = gr.Slider(minimum=1, maximum=30, step=1, label="Number of Days to Predict")
117
+ predict_button = gr.Button("Predict")
118
+ prediction_output = gr.Textbox(label="Predictions", interactive=False)
119
+
120
+ predict_button.click(call_predict, inputs=num_predictions, outputs=prediction_output)
121
+
122
+ with gr.Tab("Retrieve Economic Data"):
123
+ retrieve_button = gr.Button("Get Economic Data")
124
+ data_output = gr.Textbox(label="Economic Data", interactive=False)
125
+
126
+ retrieve_button.click(call_economic_data, outputs=data_output)
127
+
128
+ demo.launch(server_name="0.0.0.0", server_port=7860, share=True)