Spaces:
Running
Running
feat(ui): Forecast tab pre-fills T/top_p from cached tuning
Browse files
app.py
CHANGED
|
@@ -437,6 +437,8 @@ with gr.Blocks(title="Kronos Forecast Dashboard", theme=gr.themes.Soft()) as dem
|
|
| 437 |
sample_count = gr.Slider(1, 30, 5, step=1, label="Monte Carlo samples (cpu-basic: 30 ≈ 4 min)")
|
| 438 |
temperature = gr.Slider(0.1, 2.0, 1.0, step=0.1, label="Temperature (T)")
|
| 439 |
top_p = gr.Slider(0.1, 1.0, 0.9, step=0.05, label="Top-p")
|
|
|
|
|
|
|
| 440 |
run_btn = gr.Button("🚀 Forecast", variant="primary")
|
| 441 |
with gr.Column(scale=3):
|
| 442 |
chart_out = gr.Plot(label="Forecast Chart")
|
|
@@ -447,6 +449,22 @@ with gr.Blocks(title="Kronos Forecast Dashboard", theme=gr.themes.Soft()) as dem
|
|
| 447 |
outputs=[chart_out, summary_out, pred_out],
|
| 448 |
concurrency_id="predictor", concurrency_limit=1)
|
| 449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
# ---- Watchlist tab ----
|
| 451 |
with gr.Tab("Watchlist"):
|
| 452 |
with gr.Row():
|
|
|
|
| 437 |
sample_count = gr.Slider(1, 30, 5, step=1, label="Monte Carlo samples (cpu-basic: 30 ≈ 4 min)")
|
| 438 |
temperature = gr.Slider(0.1, 2.0, 1.0, step=0.1, label="Temperature (T)")
|
| 439 |
top_p = gr.Slider(0.1, 1.0, 0.9, step=0.05, label="Top-p")
|
| 440 |
+
use_tuned = gr.Checkbox(value=True,
|
| 441 |
+
label="🎯 Use tuned defaults (if cached)")
|
| 442 |
run_btn = gr.Button("🚀 Forecast", variant="primary")
|
| 443 |
with gr.Column(scale=3):
|
| 444 |
chart_out = gr.Plot(label="Forecast Chart")
|
|
|
|
| 449 |
outputs=[chart_out, summary_out, pred_out],
|
| 450 |
concurrency_id="predictor", concurrency_limit=1)
|
| 451 |
|
| 452 |
+
def _apply_tuning_to_sliders(symbol_val, interval_val, use_val):
|
| 453 |
+
t_val, p_val = autotune.apply_tuning(DB_PATH, symbol_val, interval_val, use_val)
|
| 454 |
+
t_update = gr.update(value=t_val) if t_val is not None else gr.update()
|
| 455 |
+
p_update = gr.update(value=p_val) if p_val is not None else gr.update()
|
| 456 |
+
return t_update, p_update
|
| 457 |
+
|
| 458 |
+
symbol.change(_apply_tuning_to_sliders,
|
| 459 |
+
inputs=[symbol, interval, use_tuned],
|
| 460 |
+
outputs=[temperature, top_p])
|
| 461 |
+
interval.change(_apply_tuning_to_sliders,
|
| 462 |
+
inputs=[symbol, interval, use_tuned],
|
| 463 |
+
outputs=[temperature, top_p])
|
| 464 |
+
use_tuned.change(_apply_tuning_to_sliders,
|
| 465 |
+
inputs=[symbol, interval, use_tuned],
|
| 466 |
+
outputs=[temperature, top_p])
|
| 467 |
+
|
| 468 |
# ---- Watchlist tab ----
|
| 469 |
with gr.Tab("Watchlist"):
|
| 470 |
with gr.Row():
|