Skip to content

gr.Video and gr.Image break API schema on ZeroGPU Spaces (Gradio 5.0.0) #13193

@pelegs202-design

Description

@pelegs202-design

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions