Maxim Kruglikov Claude Opus 4.7 (1M context) commited on
Commit
5d76f8c
·
1 Parent(s): 836e4c0

Silence /api/info crash loop: bump gradio and disable API panel

Browse files

gradio_client 5.9.1 (preinstalled in the ZeroGPU base image) crashes in
get_type() when it encounters a boolean JSON schema — gr.Dataframe's
schema hits that path, producing a TypeError on every hit to /api/info.
Fixed in later 5.x; pin gradio>=5.25.0. Also launch with show_api=False
so the endpoint is not served at all for this visual-only demo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (3) hide show
  1. CLAUDE.md +7 -0
  2. app.py +3 -1
  3. requirements.txt +1 -1
CLAUDE.md CHANGED
@@ -195,6 +195,13 @@ curl -s "https://huggingface.co/api/spaces/olfronar/megastyle-comparison" | \
195
  crashes at import. Vision-only inference has no use for the tokenizer. Load
196
  `SiglipImageProcessor.from_pretrained(SIGLIP_ID)` directly — the `pixel_values` output is
197
  identical.
 
 
 
 
 
 
 
198
  - **Match upstream preprocessing exactly.** If you find yourself tempted to resize, center-crop, or
199
  change color-space conversion manually instead of going through the SigLIP image processor, stop
200
  — the metric will silently degrade.
 
195
  crashes at import. Vision-only inference has no use for the tokenizer. Load
196
  `SiglipImageProcessor.from_pretrained(SIGLIP_ID)` directly — the `pixel_values` output is
197
  identical.
198
+ - **Pin `gradio>=5.25.0`, and launch with `show_api=False`.** HF's base image preinstalls
199
+ `gradio==5.9.1`, which has a `gradio_client.utils.get_type` that can't handle boolean JSON
200
+ schemas (valid JSON-Schema shorthand for accept-anything). `gr.Dataframe` triggers this path in
201
+ `/api/info`, producing a flood of `TypeError: argument of type 'bool' is not iterable` in the
202
+ run logs every time anything hits the API endpoint. Fixed in later 5.x. `show_api=False` on
203
+ `launch()` is an additional guard that prevents the endpoint from being exposed at all — we
204
+ don't need programmatic API access for a visual-only demo.
205
  - **Match upstream preprocessing exactly.** If you find yourself tempted to resize, center-crop, or
206
  change color-space conversion manually instead of going through the SigLIP image processor, stop
207
  — the metric will silently degrade.
app.py CHANGED
@@ -195,4 +195,6 @@ with gr.Blocks(title="MegaStyle Style Comparison", theme=gr.themes.Soft()) as de
195
 
196
 
197
  if __name__ == "__main__":
198
- demo.queue().launch()
 
 
 
195
 
196
 
197
  if __name__ == "__main__":
198
+ # show_api=False avoids the /api/info endpoint whose JSON-schema walker
199
+ # crashes on gr.Dataframe in older Gradio versions. Harmless for a demo Space.
200
+ demo.queue().launch(show_api=False)
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio>=5.0.0
2
  torch>=2.1.0
3
  transformers>=4.45.0
4
  Pillow>=10.0.0
 
1
+ gradio>=5.25.0
2
  torch>=2.1.0
3
  transformers>=4.45.0
4
  Pillow>=10.0.0