pablovela5620 Claude Fable 5 commited on
Commit
f5d0a1f
·
1 Parent(s): 6324ae7

Surface run failures in the status banner and toast

Browse files

An error mid-run left only a bare Error chip: the toast for uncaught
exceptions carried no message and dismissed itself. show_error puts the
exception text in the toast, and the GPU and publish links now write a
persistent Failed line into the status banner before raising.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files changed (1) hide show
  1. fdanyone_app.py +17 -6
fdanyone_app.py CHANGED
@@ -133,7 +133,13 @@ def run_gpu(spec: RunSpec) -> Iterator[tuple[dict | None, bytes | None, str]]:
133
  for label in generate:
134
  yield None, link.read(), label
135
  except FourDAnyoneError as exc:
 
 
136
  raise gr.Error(str(exc)) from None
 
 
 
 
137
  yield session.summary, link.read(), "Publishing the result."
138
 
139
 
@@ -143,11 +149,16 @@ def publish_cpu(spec: RunSpec, summary: dict | None) -> Iterator[tuple[bytes | N
143
  if summary is None:
144
  raise gr.Error("The generation phase did not publish a result.")
145
  link: Link = open_link(spec.token)
146
- label: str = (
147
- smoke_publish_phase(link.recording, spec)
148
- if STREAM_SMOKE
149
- else publish_phase(link.recording, spec, summary)
150
- )
 
 
 
 
 
151
  yield link.read(), label
152
 
153
 
@@ -266,4 +277,4 @@ def build_demo() -> gr.Blocks:
266
 
267
  if __name__ == "__main__":
268
  logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s")
269
- build_demo().launch(ssr_mode=False, css=STATUS_CSS)
 
133
  for label in generate:
134
  yield None, link.read(), label
135
  except FourDAnyoneError as exc:
136
+ # The banner keeps the reason on screen after the toast dismisses.
137
+ yield None, link.read(), f"Failed: {exc}"
138
  raise gr.Error(str(exc)) from None
139
+ except Exception as exc:
140
+ message: str = f"{type(exc).__name__}: {exc}"
141
+ yield None, link.read(), f"Failed: {message}"
142
+ raise gr.Error(message) from exc
143
  yield session.summary, link.read(), "Publishing the result."
144
 
145
 
 
149
  if summary is None:
150
  raise gr.Error("The generation phase did not publish a result.")
151
  link: Link = open_link(spec.token)
152
+ try:
153
+ label: str = (
154
+ smoke_publish_phase(link.recording, spec)
155
+ if STREAM_SMOKE
156
+ else publish_phase(link.recording, spec, summary)
157
+ )
158
+ except Exception as exc:
159
+ message: str = f"{type(exc).__name__}: {exc}"
160
+ yield link.read(), f"Failed: {message}"
161
+ raise gr.Error(message) from exc
162
  yield link.read(), label
163
 
164
 
 
277
 
278
  if __name__ == "__main__":
279
  logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s")
280
+ build_demo().launch(ssr_mode=False, css=STATUS_CSS, show_error=True)