Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -91,6 +91,15 @@ with tab_ops:
|
|
| 91 |
st.warning(f"Aucune prédiction enregistrée sur les {hours} dernières heures.")
|
| 92 |
st.stop()
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
cols = st.columns(6)
|
| 95 |
cols[0].metric("Total requêtes", f"{summary['total']:,}")
|
| 96 |
cols[1].metric(
|
|
@@ -100,14 +109,14 @@ with tab_ops:
|
|
| 100 |
delta_color="inverse",
|
| 101 |
)
|
| 102 |
cols[2].metric(
|
| 103 |
-
"
|
| 104 |
-
f"{
|
| 105 |
-
help="`latency_ms`
|
| 106 |
)
|
| 107 |
cols[3].metric(
|
| 108 |
-
"
|
| 109 |
-
f"{
|
| 110 |
-
help="
|
| 111 |
)
|
| 112 |
cols[4].metric(
|
| 113 |
"% REFUSED",
|
|
@@ -169,33 +178,38 @@ with tab_ops:
|
|
| 169 |
"entrée dans le `finally`) — typiquement < 1 ms."
|
| 170 |
)
|
| 171 |
|
| 172 |
-
cols_perf = st.columns(
|
| 173 |
cols_perf[0].metric(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
"Handler p50 / p95",
|
| 175 |
f"{handler_p50} / {handler_p95} ms",
|
| 176 |
help="`latency_ms` = assembly + inference + plumbing. **N'inclut pas** le DB log.",
|
| 177 |
)
|
| 178 |
-
cols_perf[
|
| 179 |
"Feature assembly p50 / p95",
|
| 180 |
f"{asm_p50} / {asm_p95} ms",
|
| 181 |
help="Lookup feature store + transforms + ratios + reindex.",
|
| 182 |
)
|
| 183 |
-
cols_perf[
|
| 184 |
"Inference wall p50 / p95",
|
| 185 |
f"{inf_p50} / {inf_p95} ms",
|
| 186 |
help="`model.predict_proba` (wall-clock).",
|
| 187 |
)
|
| 188 |
-
cols_perf[
|
| 189 |
"Inference CPU p50 / p95",
|
| 190 |
f"{inf_cpu_p50} / {inf_cpu_p95} ms",
|
| 191 |
help="CPU time consommé pendant l'inférence (peut lire 0 sur paths très rapides — résolution de `time.process_time`).",
|
| 192 |
)
|
| 193 |
-
cols_perf[
|
| 194 |
"DB log p50 / p95",
|
| 195 |
f"{db_log_p50} / {db_log_p95} ms",
|
| 196 |
help="INSERT Supabase mesuré autour de `conn.execute(insert(...))` dans `api/logger.py`. Domine généralement l'overhead total.",
|
| 197 |
)
|
| 198 |
-
cols_perf[
|
| 199 |
"Plumbing Δ p50 / p95",
|
| 200 |
f"{plumb_p50} / {plumb_p95} ms",
|
| 201 |
help="`latency_ms - feature_assembly_ms - inference_ms`. Résidu Python entre les sous-mesures (typiquement < 1 ms).",
|
|
|
|
| 91 |
st.warning(f"Aucune prédiction enregistrée sur les {hours} dernières heures.")
|
| 92 |
st.stop()
|
| 93 |
|
| 94 |
+
# Headline: total server-side wall-clock = handler + DB log. The detail
|
| 95 |
+
# decomposition lives in the dedicated section below.
|
| 96 |
+
_total_p50_top = int(round(float(summary["p50"] or 0))) + int(
|
| 97 |
+
round(float(summary["db_log_p50"] or 0))
|
| 98 |
+
)
|
| 99 |
+
_total_p95_top = int(round(float(summary["p95"] or 0))) + int(
|
| 100 |
+
round(float(summary["db_log_p95"] or 0))
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
cols = st.columns(6)
|
| 104 |
cols[0].metric("Total requêtes", f"{summary['total']:,}")
|
| 105 |
cols[1].metric(
|
|
|
|
| 109 |
delta_color="inverse",
|
| 110 |
)
|
| 111 |
cols[2].metric(
|
| 112 |
+
"Total p50",
|
| 113 |
+
f"{_total_p50_top} ms",
|
| 114 |
+
help="Wall-clock serveur complet = handler (`latency_ms`) + DB log (`db_log_ms`). Détail dans la section *Décomposition* plus bas.",
|
| 115 |
)
|
| 116 |
cols[3].metric(
|
| 117 |
+
"Total p95",
|
| 118 |
+
f"{_total_p95_top} ms",
|
| 119 |
+
help="Wall-clock serveur p95 = handler p95 + DB log p95.",
|
| 120 |
)
|
| 121 |
cols[4].metric(
|
| 122 |
"% REFUSED",
|
|
|
|
| 178 |
"entrée dans le `finally`) — typiquement < 1 ms."
|
| 179 |
)
|
| 180 |
|
| 181 |
+
cols_perf = st.columns(7)
|
| 182 |
cols_perf[0].metric(
|
| 183 |
+
"Total p50 / p95",
|
| 184 |
+
f"{total_p50} / {total_p95} ms",
|
| 185 |
+
help="Wall-clock serveur complet = `latency_ms` (handler) + `db_log_ms` (INSERT). C'est le temps réel passé côté serveur sur une requête.",
|
| 186 |
+
)
|
| 187 |
+
cols_perf[1].metric(
|
| 188 |
"Handler p50 / p95",
|
| 189 |
f"{handler_p50} / {handler_p95} ms",
|
| 190 |
help="`latency_ms` = assembly + inference + plumbing. **N'inclut pas** le DB log.",
|
| 191 |
)
|
| 192 |
+
cols_perf[2].metric(
|
| 193 |
"Feature assembly p50 / p95",
|
| 194 |
f"{asm_p50} / {asm_p95} ms",
|
| 195 |
help="Lookup feature store + transforms + ratios + reindex.",
|
| 196 |
)
|
| 197 |
+
cols_perf[3].metric(
|
| 198 |
"Inference wall p50 / p95",
|
| 199 |
f"{inf_p50} / {inf_p95} ms",
|
| 200 |
help="`model.predict_proba` (wall-clock).",
|
| 201 |
)
|
| 202 |
+
cols_perf[4].metric(
|
| 203 |
"Inference CPU p50 / p95",
|
| 204 |
f"{inf_cpu_p50} / {inf_cpu_p95} ms",
|
| 205 |
help="CPU time consommé pendant l'inférence (peut lire 0 sur paths très rapides — résolution de `time.process_time`).",
|
| 206 |
)
|
| 207 |
+
cols_perf[5].metric(
|
| 208 |
"DB log p50 / p95",
|
| 209 |
f"{db_log_p50} / {db_log_p95} ms",
|
| 210 |
help="INSERT Supabase mesuré autour de `conn.execute(insert(...))` dans `api/logger.py`. Domine généralement l'overhead total.",
|
| 211 |
)
|
| 212 |
+
cols_perf[6].metric(
|
| 213 |
"Plumbing Δ p50 / p95",
|
| 214 |
f"{plumb_p50} / {plumb_p95} ms",
|
| 215 |
help="`latency_ms - feature_assembly_ms - inference_ms`. Résidu Python entre les sous-mesures (typiquement < 1 ms).",
|