maosamos commited on
Commit
492e6ca
·
verified ·
1 Parent(s): b294be0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -187,7 +187,7 @@ def predict_ppo(feat_row: pd.Series):
187
  probs = dist.distribution.probs.numpy()[0]
188
  action = int(np.argmax(probs))
189
  confidence = float(probs[action]) * 100.0
190
- return ACTION_LABELS[action], confidence
191
 
192
 
193
  # ---------------------------------------------------------------------------
@@ -330,8 +330,11 @@ def run_signal(symbol_key: str):
330
 
331
  if cfg["engine"] == "ppo":
332
  load_model()
333
- action, confidence = predict_ppo(last_row)
334
- engine_label = "PPO model (15m)"
 
 
 
335
  else:
336
  action, confidence = predict_rules(last_row)
337
  engine_label = "Rule-based technical signal (15m) — not ML"
@@ -424,4 +427,4 @@ with gr.Blocks(css=CUSTOM_CSS, title="Signal Dashboard (Educational)") as demo:
424
  demo.load(fn=run_signal, inputs=[symbol_dd], outputs=[signal_card, chart])
425
 
426
  if __name__ == "__main__":
427
- demo.launch()
 
187
  probs = dist.distribution.probs.numpy()[0]
188
  action = int(np.argmax(probs))
189
  confidence = float(probs[action]) * 100.0
190
+ return ACTION_LABELS[action], confidence, probs
191
 
192
 
193
  # ---------------------------------------------------------------------------
 
330
 
331
  if cfg["engine"] == "ppo":
332
  load_model()
333
+ action, confidence, probs = predict_ppo(last_row)
334
+ engine_label = (
335
+ f"PPO model (15m) · Hold {probs[0]*100:.0f}% · "
336
+ f"Buy {probs[1]*100:.0f}% · Sell {probs[2]*100:.0f}%"
337
+ )
338
  else:
339
  action, confidence = predict_rules(last_row)
340
  engine_label = "Rule-based technical signal (15m) — not ML"
 
427
  demo.load(fn=run_signal, inputs=[symbol_dd], outputs=[signal_card, chart])
428
 
429
  if __name__ == "__main__":
430
+ demo.launch()