FastAPI / Gradio Error: TypeError: argument of type 'bool' is not iterable
I’m running into an error when using Gradio (wrapped in FastAPI, served with uvicorn). When a frontend interaction is triggered, I get the following traceback (excerpt):
TypeError: argument of type 'bool' is not iterable
File "gradio_client\utils.py", line 898, in get_type
if "const" in schema:
Context:
Here’s the code that causes the error:
im_display.change(fn=update_image, inputs=[im_display], outputs=[s3image])
im_display
is agr.Image()
s3image
is also agr.Image()
- The function
update_image
returnsgr.update(...)
If I change the output to a
gr.Textbox()
, like this:
im_display.change(fn=update_image, inputs=[im_display], outputs=[gr.Textbox()])
Then the error does not happen. So the issue seems to be related to using gr.Image
as the output.
Additional Info:
- The error still happens no matter what arguments I pass to
gr.update()
, e.g.,value=...
,visible=True
, etc. - Everything works fine when returning updates to a
Textbox
.
Question:
Has anyone else run into this issue when returning gr.update()
to a gr.Image()
output?
Is there a workaround or fix for this schema parsing issue?
My environment:
- Windows / Conda
- Python 3.x
- Gradio installed via pip (5.20)
Any help is appreciated! I can provide a minimal reproducible example if needed.