Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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()}"
|
| 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.
|
| 288 |
-
with gr.
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
with gr.
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
|
|
|
| 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"))
|