ghstedpixel commited on
Commit
eb91eb3
ยท
verified ยท
1 Parent(s): 9cf6389

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -35
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
- # --- SECTION 1: WATCHLIST ---
341
- gr.Markdown("### Watchlist Management")
342
- with gr.Row():
343
- ticker_input = gr.Textbox(label="Ticker", placeholder="NVDA", scale=3)
344
- add_btn = gr.Button("โž• Add", scale=1)
345
- remove_btn = gr.Button("๐Ÿ—‘๏ธ Remove", scale=1)
346
-
347
- watchlist_display = gr.Dataframe(
348
- headers=["Ticker"],
349
- value=get_current_watchlist(),
350
- label="Current Watchlist"
351
- )
352
-
353
- gr.Markdown("---")
354
-
355
- # --- SECTION 2: TRAINING (REINSTATED) ---
356
- gr.Markdown("### Incremental Training Loop")
357
- # Hidden input that holds the sector ETFs for the trainer
358
- cal_input = gr.Textbox(value=",".join(SECTOR_ETFS), visible=False)
359
- cal_btn = gr.Button("Learn & Sync to Cloud", variant="stop")
360
- cal_out = gr.Markdown("Ready to learn.")
361
-
362
- # Link the training function back up
363
- cal_btn.click(run_incremental_training, cal_input, [cal_out])
364
-
365
- gr.Markdown("---")
366
-
367
- # --- SECTION 3: DISCORD ---
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