Spaces:
Runtime error
Runtime error
Use startup-safe session list
Browse files
app.py
CHANGED
|
@@ -26,6 +26,35 @@ FILE_SUFFIX = "_rollout.jsonl"
|
|
| 26 |
PAGE_SIZE = 120
|
| 27 |
MAX_OUTPUT_CHARS = 22000
|
| 28 |
MAX_MESSAGE_CHARS = 30000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
ANSI_RE = re.compile(r"\x1b\[[0-9;?]*[ -/]*[@-~]")
|
| 31 |
TIMESTAMP_KEYS = (
|
|
@@ -140,13 +169,15 @@ def _list_sessions_cached() -> tuple[tuple[str, ...], str]:
|
|
| 140 |
return sessions, ""
|
| 141 |
|
| 142 |
|
| 143 |
-
def _session_choices() -> list[str]:
|
|
|
|
|
|
|
| 144 |
sessions, _ = _list_sessions_cached()
|
| 145 |
-
return list(sessions)
|
| 146 |
|
| 147 |
|
| 148 |
def _default_session() -> str | None:
|
| 149 |
-
choices = _session_choices()
|
| 150 |
return choices[0] if choices else None
|
| 151 |
|
| 152 |
|
|
@@ -570,7 +601,8 @@ def _initial_view(choices: list[str]) -> tuple[str, str, str, int]:
|
|
| 570 |
|
| 571 |
|
| 572 |
def render_session(session_name: str | None, query: str | None = "", page: int | float | None = 1) -> tuple[str, str, str, int]:
|
| 573 |
-
choices
|
|
|
|
| 574 |
if not choices:
|
| 575 |
return _render_error("Dataset file list unavailable", list_error or "HF_TOKEN is not configured.")
|
| 576 |
|
|
@@ -1128,7 +1160,7 @@ html, body, .gradio-container {
|
|
| 1128 |
|
| 1129 |
|
| 1130 |
def build_app() -> gr.Blocks:
|
| 1131 |
-
choices = _session_choices()
|
| 1132 |
default = None
|
| 1133 |
initial_summary, initial_transcript, initial_page_info, initial_page = _initial_view(choices)
|
| 1134 |
|
|
|
|
| 26 |
PAGE_SIZE = 120
|
| 27 |
MAX_OUTPUT_CHARS = 22000
|
| 28 |
MAX_MESSAGE_CHARS = 30000
|
| 29 |
+
KNOWN_SESSIONS = (
|
| 30 |
+
"agents-a1-demo",
|
| 31 |
+
"ai-agent-soccer",
|
| 32 |
+
"anime-soccer-generator",
|
| 33 |
+
"asasr-space",
|
| 34 |
+
"codex-traces-viewer",
|
| 35 |
+
"craft-agents-oss",
|
| 36 |
+
"deepspec-space",
|
| 37 |
+
"edit-anything",
|
| 38 |
+
"fractal-pi-extension",
|
| 39 |
+
"gaussian-splat-demo",
|
| 40 |
+
"hf-history-article",
|
| 41 |
+
"hf-motion-video",
|
| 42 |
+
"horus-hiero-space",
|
| 43 |
+
"locate-anything-space",
|
| 44 |
+
"ltx-3dreal-space",
|
| 45 |
+
"microworld-space",
|
| 46 |
+
"olmoearth-demo",
|
| 47 |
+
"paris-13-landing",
|
| 48 |
+
"pulpie-demo",
|
| 49 |
+
"pulpie-gguf",
|
| 50 |
+
"pulpie-mlx",
|
| 51 |
+
"pulpie-onnx",
|
| 52 |
+
"pulpie-web-demo",
|
| 53 |
+
"qwen3-asr-space",
|
| 54 |
+
"rampart-demo",
|
| 55 |
+
"sync-lora-space",
|
| 56 |
+
"tabfm-arena",
|
| 57 |
+
)
|
| 58 |
|
| 59 |
ANSI_RE = re.compile(r"\x1b\[[0-9;?]*[ -/]*[@-~]")
|
| 60 |
TIMESTAMP_KEYS = (
|
|
|
|
| 169 |
return sessions, ""
|
| 170 |
|
| 171 |
|
| 172 |
+
def _session_choices(live: bool = True) -> list[str]:
|
| 173 |
+
if not live:
|
| 174 |
+
return list(KNOWN_SESSIONS)
|
| 175 |
sessions, _ = _list_sessions_cached()
|
| 176 |
+
return list(sessions or KNOWN_SESSIONS)
|
| 177 |
|
| 178 |
|
| 179 |
def _default_session() -> str | None:
|
| 180 |
+
choices = _session_choices(live=False)
|
| 181 |
return choices[0] if choices else None
|
| 182 |
|
| 183 |
|
|
|
|
| 601 |
|
| 602 |
|
| 603 |
def render_session(session_name: str | None, query: str | None = "", page: int | float | None = 1) -> tuple[str, str, str, int]:
|
| 604 |
+
choices = KNOWN_SESSIONS
|
| 605 |
+
list_error = ""
|
| 606 |
if not choices:
|
| 607 |
return _render_error("Dataset file list unavailable", list_error or "HF_TOKEN is not configured.")
|
| 608 |
|
|
|
|
| 1160 |
|
| 1161 |
|
| 1162 |
def build_app() -> gr.Blocks:
|
| 1163 |
+
choices = _session_choices(live=False)
|
| 1164 |
default = None
|
| 1165 |
initial_summary, initial_transcript, initial_page_info, initial_page = _initial_view(choices)
|
| 1166 |
|