Hi! I'm building a HuggingFace Space on ZeroGPU and hitting a frustrating bug where using gr.Video, gr.Image, gr.Audio, or gr.JSON as inputs/outputs completely breaks the Gradio API.
Environment:
The bug:
When any of these components are used as outputs in gr.Blocks, the /gradio_api/call/<api_name> endpoint returns event: error with data: null. The Gradio client also fails to connect with:
TypeError: argument of type 'bool' is not iterable
The traceback points to gradio_client/utils.py line 882 in get_type:
if "const" in schema: # <-- schema is a bool, not a dict
Minimal repro:
import gradio as gr
def analyze(text):
return "scores here", "path/to/chart.png", "insight"
with gr.Blocks() as demo:
inp = gr.Textbox()
btn = gr.Button("Go")
out1 = gr.Textbox()
out2 = gr.Image(type="filepath") # <-- adding this breaks ALL API endpoints
out3 = gr.Textbox()
btn.click(analyze, [inp], [out1, out2, out3], api_name="predict")
demo.queue().launch()
Workaround:
Using only gr.Textbox inputs and outputs makes everything work fine — API, client, web UI. But that means no image/video/audio components at all, which defeats the purpose of having a rich UI.
What I've tried:
gr.Blocks instead of gr.Interface — same bug
- Python 3.10 and 3.12 — same bug on both
- Explicit
api_name on every function — doesn't help
type="filepath" on gr.Image — same bug
Is this a known issue with the ZeroGPU base image's Gradio version? Is there a fix or a newer Gradio version that works on ZeroGPU?
Hi! I'm building a HuggingFace Space on ZeroGPU and hitting a frustrating bug where using
gr.Video,gr.Image,gr.Audio, orgr.JSONas inputs/outputs completely breaks the Gradio API.Environment:
The bug:
When any of these components are used as outputs in
gr.Blocks, the/gradio_api/call/<api_name>endpoint returnsevent: errorwithdata: null. The Gradio client also fails to connect with:The traceback points to
gradio_client/utils.pyline 882 inget_type:Minimal repro:
Workaround:
Using only
gr.Textboxinputs and outputs makes everything work fine — API, client, web UI. But that means no image/video/audio components at all, which defeats the purpose of having a rich UI.What I've tried:
gr.Blocksinstead ofgr.Interface— same bugapi_nameon every function — doesn't helptype="filepath"on gr.Image — same bugIs this a known issue with the ZeroGPU base image's Gradio version? Is there a fix or a newer Gradio version that works on ZeroGPU?