Registry / web-framework / gradio

gradio

JSON →
library6.10.0pypypiunverified

Python library for building ML demo web apps. Current version is 6.10.0 (Mar 2026). Requires Python >=3.10. Three major breaking version bumps in rapid succession (3→4→5→6). The most common LLM footgun: gr.update() was removed in 4.0 — return component instances directly. Chatbot tuple format removed in 6.0 — must use messages dict format. LLMs trained before 2024 generate 3.x patterns that fail on 6.x.

web-frameworkai-mlllm-agents
pip install gradio
Install & Compatibility
Where this runs
tested against v6.17.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 17.03s
py 3.11
✓ —
✓ 16.23s
py 3.12
✓ —
✓ 14.7s
py 3.13
✓ —
✓ 14.77s
py 3.9
3/5 runs
3/5 runs
382MB installed
● package 382MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gr.Interface
import gradio as gr # Simple Interface (gr.update() is gone — return values directly) def greet(name, intensity): return 'Hello, ' + name + '!' * intensity demo = gr.Interface( fn=greet, inputs=[gr.Textbox(label='Name'), gr.Slider(1, 10, value=3)], outputs=gr.Textbox(label='Greeting') ) demo.launch()
# gr.update() removed in 4.0 — AttributeError in 4.x+: def update_textbox(text): return gr.update(value=text, visible=True) # AttributeError # Also wrong — old tuple chatbot format removed in 6.0: chatbot = gr.Chatbot(value=[['Hello', 'Hi there!']]) # breaks in 6.0
gr.update() was removed in Gradio 4.0. Return component instances directly: return gr.Textbox(value='text', visible=True). Chatbot messages must use dict format in 6.0+: [{'role': 'user', 'content': 'Hello'}]

6.x API. Use type='messages' for gr.Chatbot. Return component instances, not gr.update().

import gradio as gr # Simple Interface def classify_text(text): return {'positive': 0.8, 'negative': 0.2} gr.Interface( fn=classify_text, inputs=gr.Textbox(label='Input Text'), outputs=gr.Label(label='Sentiment') ).launch() # Blocks API (more flexible) def chat(message, history): # history is list of dicts: [{role, content}, ...] response = f'Echo: {message}' return response with gr.Blocks() as demo: gr.Markdown('# My Chatbot') chatbot = gr.Chatbot(type='messages') # dict format required in 6.0 msg = gr.Textbox(label='Message') btn = gr.Button('Send') def respond(message, history): history.append({'role': 'user', 'content': message}) history.append({'role': 'assistant', 'content': f'Echo: {message}'}) return '', history btn.click(respond, [msg, chatbot], [msg, chatbot]) demo.launch(share=True)
gradio --version
Debug
Known issues
breakinggr.update() was removed in Gradio 4.0. The entire pattern of returning gr.Textbox.update(value='x') or gr.update(visible=True) raises AttributeError. This is the #1 footgun from LLM-generated code using old Gradio docs.
fix
Return a component instance directly: return gr.Textbox(value='text', visible=True). For multiple outputs, return a tuple: return gr.Textbox(value='text'), gr.Button(visible=False)
affects: >= 4.0
breakingChatbot tuple format ([['user', 'assistant'], ...]) removed in Gradio 6.0. gr.Chatbot() and gr.ChatInterface() now require dict messages format: [{'role': 'user', 'content': '...'}, {'role': 'assistant', 'content': '...'}]
fix
Use type='messages' in gr.Chatbot(type='messages'). Format history as: [{'role': 'user', 'content': msg}, {'role': 'assistant', 'content': response}]
affects: >= 6.0
breakingtheme= parameter removed from gr.Blocks() in Gradio 6.0. TypeError: BlockContext.__init__() got an unexpected keyword argument 'theme'. Breaks all apps using gr.Blocks(theme=gr.themes.Soft()).
fix
Pass theme at the app level instead: demo = gr.Blocks(); demo.theme = gr.themes.Soft(). Or use theme in gr.Interface(theme=...).
affects: >= 6.0
breakingconcurrency_count parameter removed in Gradio 4.0. Per-event concurrency_limit replaced it. queue=False also removed — use concurrency_limit=None instead.
fix
Replace: demo.queue(concurrency_count=5) with per-event: btn.click(fn, ..., concurrency_limit=5). For unlimited: concurrency_limit=None.
affects: >= 4.0
breakingIn Gradio 5.0+, functions can only return files in the current working directory or temp directory. Returning absolute paths to arbitrary system files is blocked for security.
fix
Save output files to tempfile.NamedTemporaryFile() or the current working directory. Return the path from tempfile.
affects: >= 5.0
gotchaPython 3.10 is now the minimum. Running Gradio on Python 3.9 may lead to dependency conflicts, such as `ImportError: cannot import name 'HfFolder' from 'huggingface_hub'`, as newer Gradio versions and their dependencies are designed for Python 3.10+.
fix
Upgrade to Python 3.10+. Pin gradio<5.0 for Python 3.9 environments.
affects: >= 5.0
gotchaLLMs (including ChatGPT and Copilot) frequently generate Gradio 3.x code with gr.update() and tuple chatbot format that fails on 6.x. Always verify which Gradio version the generated code targets.
fix
When using AI to generate Gradio code, explicitly prompt: 'Use Gradio 6.x API — no gr.update(), use messages dict format for Chatbot.'
affects: all
Upgrade
Version history
6.17.3latest on PyPI
Audit
Dependencies
fastapirequiredRequired. Web server backend. Installed automatically.
pydantic>=2.0requiredRequired. Installed automatically.
httpxrequiredRequired. Installed automatically.
Agent activity
105 hits · last 30 days
node
16
mj12bot
4
bytedance
4
seranking-bot
4
ahrefsbot
3
Amazon
1
Resources