Spaces:
Sleeping
Sleeping
Commit ·
1f6b940
1
Parent(s): 17bf2e0
Log exception type/repr and traceback in infer() error path
Browse filesDiagnosing "Could not parse server response. Syntax error '<'" reports on
High-Detail mode: the browser is getting HTML instead of JSON back from the
SSE queue, which points to Gradio failing to serialize the caught exception
rather than the underlying error itself (a recent case was a ZeroGPU quota
rejection, confirmed via the firered-turbo-logs dataset, whose exact
exception type/attrs aren't visible from str(e) alone). This logs the
concrete type/module and full traceback so the next occurrence is easier to
pin down.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -462,6 +462,13 @@ def infer(images_b64_json, prompt, seed, randomize_seed, guidance_scale, steps,
|
|
| 462 |
return result_image, seed
|
| 463 |
except Exception as e:
|
| 464 |
duration = time.perf_counter() - t0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
_spawn_log(pil_images, None, prompt, seed, steps, guidance_scale, width, height, duration, False, str(e))
|
| 466 |
raise
|
| 467 |
|
|
|
|
| 462 |
return result_image, seed
|
| 463 |
except Exception as e:
|
| 464 |
duration = time.perf_counter() - t0
|
| 465 |
+
# Diagnosing "Could not parse server response. Syntax error '<'" client-side errors —
|
| 466 |
+
# that means the browser got HTML instead of JSON from the SSE stream, which points to
|
| 467 |
+
# Gradio failing to serialize this exception rather than the exception itself. Logging
|
| 468 |
+
# the concrete type/module here (not just str(e)) so we can tell whether it's a plain
|
| 469 |
+
# Exception, a gr.Error, or something from the `spaces` package with non-standard attrs.
|
| 470 |
+
print(f"[infer] EXCEPTION type={type(e).__module__}.{type(e).__qualname__} repr={e!r}")
|
| 471 |
+
traceback.print_exc()
|
| 472 |
_spawn_log(pil_images, None, prompt, seed, steps, guidance_scale, width, height, duration, False, str(e))
|
| 473 |
raise
|
| 474 |
|