Update app.py
Browse files
app.py
CHANGED
|
@@ -379,6 +379,7 @@ button#analyze-btn {
|
|
| 379 |
"""
|
| 380 |
|
| 381 |
# Gradio interface
|
|
|
|
| 382 |
def create_gradio_interface():
|
| 383 |
with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
|
| 384 |
gr.Markdown("# Fundamental Financial Analysis")
|
|
@@ -393,9 +394,7 @@ def create_gradio_interface():
|
|
| 393 |
placeholder="AAPL, MSFT, GOOG, AMZN, TSLA",
|
| 394 |
lines=1
|
| 395 |
)
|
| 396 |
-
|
| 397 |
-
analyze_btn = gr.Button("Analyze Stocks", variant="primary")
|
| 398 |
-
download_btn = gr.Button("📥 Download Tables (.txt)", variant="secondary")
|
| 399 |
|
| 400 |
with gr.Row():
|
| 401 |
with gr.Column():
|
|
@@ -417,7 +416,11 @@ def create_gradio_interface():
|
|
| 417 |
bar_chart_output = gr.Plot(label="Component Scores Chart")
|
| 418 |
with gr.Column():
|
| 419 |
radar_chart_output = gr.Plot(label="Top Stocks Comparison")
|
| 420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
with gr.TabItem("Help & Information"):
|
| 422 |
gr.Markdown("""
|
| 423 |
## How to Use This Tool
|
|
@@ -442,7 +445,7 @@ def create_gradio_interface():
|
|
| 442 |
Financial data is provided by Yahoo Finance via the yfinance package.
|
| 443 |
""")
|
| 444 |
|
| 445 |
-
# State to store
|
| 446 |
scores_state = gr.State(pd.DataFrame())
|
| 447 |
metrics_state = gr.State(pd.DataFrame())
|
| 448 |
|
|
@@ -464,11 +467,12 @@ def create_gradio_interface():
|
|
| 464 |
download_btn.click(
|
| 465 |
download_wrapper,
|
| 466 |
inputs=[scores_state, metrics_state],
|
| 467 |
-
outputs=
|
| 468 |
)
|
| 469 |
|
| 470 |
return iface
|
| 471 |
|
|
|
|
| 472 |
# Entry point
|
| 473 |
if __name__ == "__main__":
|
| 474 |
logger.info("Starting Stock Analyzer app")
|
|
|
|
| 379 |
"""
|
| 380 |
|
| 381 |
# Gradio interface
|
| 382 |
+
|
| 383 |
def create_gradio_interface():
|
| 384 |
with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
|
| 385 |
gr.Markdown("# Fundamental Financial Analysis")
|
|
|
|
| 394 |
placeholder="AAPL, MSFT, GOOG, AMZN, TSLA",
|
| 395 |
lines=1
|
| 396 |
)
|
| 397 |
+
analyze_btn = gr.Button("Analyze Stocks", variant="primary")
|
|
|
|
|
|
|
| 398 |
|
| 399 |
with gr.Row():
|
| 400 |
with gr.Column():
|
|
|
|
| 416 |
bar_chart_output = gr.Plot(label="Component Scores Chart")
|
| 417 |
with gr.Column():
|
| 418 |
radar_chart_output = gr.Plot(label="Top Stocks Comparison")
|
| 419 |
+
|
| 420 |
+
# --- DOWNLOAD BUTTON MOVED HERE (at the bottom, inside the tab) ---
|
| 421 |
+
download_btn = gr.Button("📥 Download Tables (.txt)", variant="secondary")
|
| 422 |
+
download_file = gr.File(visible=False) # Hidden file output
|
| 423 |
+
|
| 424 |
with gr.TabItem("Help & Information"):
|
| 425 |
gr.Markdown("""
|
| 426 |
## How to Use This Tool
|
|
|
|
| 445 |
Financial data is provided by Yahoo Finance via the yfinance package.
|
| 446 |
""")
|
| 447 |
|
| 448 |
+
# State to store results
|
| 449 |
scores_state = gr.State(pd.DataFrame())
|
| 450 |
metrics_state = gr.State(pd.DataFrame())
|
| 451 |
|
|
|
|
| 467 |
download_btn.click(
|
| 468 |
download_wrapper,
|
| 469 |
inputs=[scores_state, metrics_state],
|
| 470 |
+
outputs=download_file
|
| 471 |
)
|
| 472 |
|
| 473 |
return iface
|
| 474 |
|
| 475 |
+
|
| 476 |
# Entry point
|
| 477 |
if __name__ == "__main__":
|
| 478 |
logger.info("Starting Stock Analyzer app")
|