Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -144,6 +144,9 @@ def save_to_csv(stock_name):
|
|
144 |
fstock, profit_data = get_stock_data(stock_name)
|
145 |
csv_file_path = f'{stock_name}.csv'
|
146 |
|
|
|
|
|
|
|
147 |
return fstock, profit_data, csv_file_path
|
148 |
|
149 |
# Create the Gradio interface
|
@@ -164,7 +167,7 @@ with gr.Blocks() as demo:
|
|
164 |
gr.Markdown("<h3 style='text-align: center;'>Output</h3>")
|
165 |
output_stock_data = gr.DataFrame(label="Dates where Conditions met", interactive=False)
|
166 |
output_rsi_data = gr.DataFrame(label="Profit and Loss Statement", interactive=False)
|
167 |
-
csv_download = gr.File(label="Download CSV")
|
168 |
|
169 |
# When the button is clicked, show the two dataframes and provide a downloadable CSV
|
170 |
submit_button.click(save_to_csv, inputs=stock_input, outputs=[output_stock_data, output_rsi_data, csv_download])
|
|
|
144 |
fstock, profit_data = get_stock_data(stock_name)
|
145 |
csv_file_path = f'{stock_name}.csv'
|
146 |
|
147 |
+
fstock['Date'] = pd.to_datetime(fstock['Date']).dt.date
|
148 |
+
profit_data['Date'] = pd.to_datetime(profit_data['Date']).dt.date
|
149 |
+
|
150 |
return fstock, profit_data, csv_file_path
|
151 |
|
152 |
# Create the Gradio interface
|
|
|
167 |
gr.Markdown("<h3 style='text-align: center;'>Output</h3>")
|
168 |
output_stock_data = gr.DataFrame(label="Dates where Conditions met", interactive=False)
|
169 |
output_rsi_data = gr.DataFrame(label="Profit and Loss Statement", interactive=False)
|
170 |
+
csv_download = gr.File(label="Download the full CSV")
|
171 |
|
172 |
# When the button is clicked, show the two dataframes and provide a downloadable CSV
|
173 |
submit_button.click(save_to_csv, inputs=stock_input, outputs=[output_stock_data, output_rsi_data, csv_download])
|