ghstedpixel commited on
Commit
cbbaf67
Β·
verified Β·
1 Parent(s): 6492d68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -36
app.py CHANGED
@@ -86,7 +86,6 @@ def save_to_cloud():
86
  except Exception as e: return f"❌ Sync Failed: {str(e)[:30]}"
87
 
88
  # --- ANALYTICS ENGINES ---
89
-
90
  def fetch_history_yf(ticker, period="5y", interval="1d"):
91
  try:
92
  dat = yf.Ticker(ticker)
@@ -216,7 +215,7 @@ def run_calibration(batch_str):
216
  with open(MODEL_PATH, "wb") as f:
217
  pickle.dump(model, f)
218
 
219
- yield f"βœ… DONE! {save_to_cloud()}", 1.0
220
 
221
  def analyze_asset(ticker):
222
  if not ticker or not ticker.strip():
@@ -280,42 +279,42 @@ def get_sector_analysis():
280
  return f"### Top Pick: {df['Sector'].iloc[0]}", fig, ai_view
281
 
282
  # --- GRADIO INTERFACE ---
283
-
284
- with gr.Blocks(theme=gr.themes.Default(primary_hue="amber")) as brie:
285
  gr.Markdown("# πŸ§€ Brie Ultra AI")
286
-
287
- with gr.Tab("πŸ” Scanner"):
288
- with gr.Row():
289
- ticker_in = gr.Textbox(label="Ticker", placeholder="NVDA", scale=4)
290
- scan_btn = gr.Button("Scan", variant="primary", scale=1)
291
-
292
- with gr.Row():
293
- chart = gr.Plot(container=True)
294
-
295
- with gr.Row():
296
- with gr.Column():
297
- res_txt = gr.Markdown()
298
- with gr.Column():
299
- prob_lbl = gr.Label(label="Alpha Probability")
300
- with gr.Column():
301
- price_lbl = gr.Label(label="Last Close")
302
-
303
- scan_btn.click(analyze_asset, ticker_in, [res_txt, chart, prob_lbl, price_lbl])
304
-
305
- with gr.Tab("πŸ“Š Sector Impact"):
306
- sector_btn = gr.Button("Refresh Macro View")
307
- sector_top = gr.Markdown()
308
- sector_chart = gr.Plot()
309
- sector_ai = gr.Markdown()
310
- sector_btn.click(get_sector_analysis, None, [sector_top, sector_chart, sector_ai])
311
-
312
- with gr.Tab("βš™οΈ Calibration"):
313
- cal_btn = gr.Button("Train & Sync")
314
- cal_out = gr.Markdown("Ready")
315
- # Gr.State is used here to handle the internal progress/state tracking
316
- cal_btn.click(run_calibration, gr.Textbox(value=",".join(SECTOR_ETFS), visible=False), [cal_out, gr.State()])
 
317
 
318
  if __name__ == "__main__":
319
  init_db()
320
  load_from_cloud()
321
- brie.launch()
 
86
  except Exception as e: return f"❌ Sync Failed: {str(e)[:30]}"
87
 
88
  # --- ANALYTICS ENGINES ---
 
89
  def fetch_history_yf(ticker, period="5y", interval="1d"):
90
  try:
91
  dat = yf.Ticker(ticker)
 
215
  with open(MODEL_PATH, "wb") as f:
216
  pickle.dump(model, f)
217
 
218
+ yield f"βœ… DONE! {save_to_cloud()}"
219
 
220
  def analyze_asset(ticker):
221
  if not ticker or not ticker.strip():
 
279
  return f"### Top Pick: {df['Sector'].iloc[0]}", fig, ai_view
280
 
281
  # --- GRADIO INTERFACE ---
282
+ with gr.Blocks() as brie:
 
283
  gr.Markdown("# πŸ§€ Brie Ultra AI")
284
+
285
+ with gr.Tabs():
286
+ with gr.Tab("πŸ” Scanner"):
287
+ with gr.Row():
288
+ ticker_in = gr.Textbox(label="Ticker", placeholder="NVDA", scale=4)
289
+ scan_btn = gr.Button("Scan", variant="primary", scale=1)
290
+
291
+ with gr.Row():
292
+ chart = gr.Plot(container=True)
293
+
294
+ with gr.Row():
295
+ with gr.Column():
296
+ res_txt = gr.Markdown()
297
+ with gr.Column():
298
+ prob_lbl = gr.Label(label="Alpha Probability")
299
+ with gr.Column():
300
+ price_lbl = gr.Label(label="Last Close")
301
+
302
+ scan_btn.click(analyze_asset, ticker_in, [res_txt, chart, prob_lbl, price_lbl])
303
+
304
+ with gr.Tab("πŸ“Š Sector Impact"):
305
+ sector_btn = gr.Button("Refresh Macro View")
306
+ sector_top = gr.Markdown()
307
+ sector_chart = gr.Plot()
308
+ sector_ai = gr.Markdown()
309
+ sector_btn.click(get_sector_analysis, None, [sector_top, sector_chart, sector_ai])
310
+
311
+ with gr.Tab("βš™οΈ Calibration"):
312
+ cal_input = gr.Textbox(value=",".join(SECTOR_ETFS), visible=False)
313
+ cal_btn = gr.Button("Train & Sync")
314
+ cal_out = gr.Markdown("Ready")
315
+ cal_btn.click(run_calibration, cal_input, [cal_out])
316
 
317
  if __name__ == "__main__":
318
  init_db()
319
  load_from_cloud()
320
+ brie.launch(theme=gr.themes.Default(primary_hue="amber"))