Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -337,41 +337,34 @@ with gr.Blocks() as brie:
|
|
| 337 |
sector_btn.click(get_sector_analysis, None, [sector_top, sector_chart, sector_ai])
|
| 338 |
|
| 339 |
with gr.Tab("โ๏ธ Continuous Learning"):
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
gr.Markdown("### Discord Integration")
|
| 369 |
-
discord_btn = gr.Button("Send Briefing to Discord", variant="primary")
|
| 370 |
-
discord_out = gr.Markdown("Standing by...")
|
| 371 |
-
|
| 372 |
-
# Logic for all buttons
|
| 373 |
-
add_btn.click(lambda t: (add_ticker_to_db(t), ""), inputs=[ticker_input], outputs=[watchlist_display, ticker_input])
|
| 374 |
-
remove_btn.click(lambda t: (remove_ticker_from_db(t), ""), inputs=[ticker_input], outputs=[watchlist_display, ticker_input])
|
| 375 |
|
| 376 |
def trigger_discord():
|
| 377 |
from brie_agent import run_alpaca_briefing
|
|
|
|
| 337 |
sector_btn.click(get_sector_analysis, None, [sector_top, sector_chart, sector_ai])
|
| 338 |
|
| 339 |
with gr.Tab("โ๏ธ Continuous Learning"):
|
| 340 |
+
gr.Markdown("### Watchlist Management")
|
| 341 |
+
with gr.Row():
|
| 342 |
+
ticker_input = gr.Textbox(label="Ticker", placeholder="NVDA", scale=3)
|
| 343 |
+
add_btn = gr.Button("โ Add", scale=1)
|
| 344 |
+
remove_btn = gr.Button("๐๏ธ Remove", scale=1)
|
| 345 |
+
|
| 346 |
+
# This must be the output for the buttons to show the 2nd, 3rd, etc. tickers
|
| 347 |
+
watchlist_display = gr.Dataframe(headers=["Ticker"], label="Current Watchlist")
|
| 348 |
+
|
| 349 |
+
gr.Markdown("---")
|
| 350 |
+
gr.Markdown("### Discord Integration")
|
| 351 |
+
with gr.Row():
|
| 352 |
+
discord_btn = gr.Button("๐ Send Briefing", variant="primary")
|
| 353 |
+
# A Label gives you a nice colored box to show it's working
|
| 354 |
+
discord_status = gr.Label(value="System Ready", label="Brie Status")
|
| 355 |
+
|
| 356 |
+
# LOGIC: Ensure we return the fresh list to the dataframe
|
| 357 |
+
def add_and_refresh(t):
|
| 358 |
+
add_ticker_to_db(t)
|
| 359 |
+
return get_current_watchlist(), "" # Returns list + clears textbox
|
| 360 |
+
|
| 361 |
+
def remove_and_refresh(t):
|
| 362 |
+
remove_ticker_from_db(t)
|
| 363 |
+
return get_current_watchlist(), ""
|
| 364 |
+
|
| 365 |
+
add_btn.click(add_and_refresh, [ticker_input], [watchlist_display, ticker_input])
|
| 366 |
+
remove_btn.click(remove_and_refresh, [ticker_input], [watchlist_display, ticker_input])
|
| 367 |
+
discord_btn.click(trigger_discord, None, [discord_status])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
|
| 369 |
def trigger_discord():
|
| 370 |
from brie_agent import run_alpaca_briefing
|