18259325a1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
import streamlit as st
|
|
|
|
from multi_swarm.dashboard.data import (
|
|
evaluations_df,
|
|
get_repo,
|
|
get_run_overview,
|
|
list_runs_df,
|
|
)
|
|
|
|
st.title("Overview")
|
|
|
|
db_path = st.session_state.get("db_path", "./runs.db")
|
|
repo = get_repo(db_path)
|
|
|
|
runs = list_runs_df(repo)
|
|
if runs.empty:
|
|
st.info("Nessuna run nel database. Esegui `scripts/run_phase1.py` per generarne una.")
|
|
st.stop()
|
|
|
|
st.subheader("Tutte le run")
|
|
st.dataframe(runs[["id", "name", "started_at", "completed_at", "status", "total_cost_usd"]])
|
|
|
|
selected = st.selectbox("Seleziona run per dettaglio", runs["id"].tolist())
|
|
overview = get_run_overview(repo, selected)
|
|
|
|
col1, col2, col3, col4 = st.columns(4)
|
|
col1.metric("Status", overview["status"])
|
|
col2.metric("Cost (USD)", f"{overview['total_cost_usd']:.4f}")
|
|
col3.metric("Started", overview["started_at"])
|
|
col4.metric("Completed", overview["completed_at"] or "—")
|
|
|
|
st.subheader("Statistiche evaluations")
|
|
evals = evaluations_df(repo, selected)
|
|
col5, col6, col7, col8 = st.columns(4)
|
|
if not evals.empty:
|
|
parse_success = 100 * (evals["parse_error"].isna().sum() / len(evals))
|
|
col5.metric("Evaluations totali", len(evals))
|
|
col6.metric("Parse success %", f"{parse_success:.1f}%")
|
|
col7.metric("Top fitness", f"{evals['fitness'].max():.3f}")
|
|
col8.metric("Median fitness", f"{evals['fitness'].median():.3f}")
|
|
else:
|
|
col5.metric("Evaluations totali", 0)
|
|
|
|
st.subheader("Config")
|
|
st.json(overview["config"])
|