{"id":238,"library":"gradio","title":"Gradio","description":"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.","status":"active","version":"6.10.0","language":"python","source_language":"en","source_url":"https://www.gradio.app/changelog","tags":["ml-demo","web-ui","machine-learning","nlp","computer-vision","hugging-face","chatbot"],"install":[{"cmd":"pip install gradio","lang":"bash","label":"Standard"}],"dependencies":[{"reason":"Required. Web server backend. Installed automatically.","package":"fastapi","optional":false},{"reason":"Required. Installed automatically.","package":"pydantic>=2.0","optional":false},{"reason":"Required. Installed automatically.","package":"httpx","optional":false}],"imports":[{"note":"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'}]","wrong":"# gr.update() removed in 4.0 — AttributeError in 4.x+:\ndef update_textbox(text):\n    return gr.update(value=text, visible=True)  # AttributeError\n\n# Also wrong — old tuple chatbot format removed in 6.0:\nchatbot = gr.Chatbot(value=[['Hello', 'Hi there!']])  # breaks in 6.0","symbol":"gr.Interface","correct":"import gradio as gr\n\n# Simple Interface (gr.update() is gone — return values directly)\ndef greet(name, intensity):\n    return 'Hello, ' + name + '!' * intensity\n\ndemo = gr.Interface(\n    fn=greet,\n    inputs=[gr.Textbox(label='Name'), gr.Slider(1, 10, value=3)],\n    outputs=gr.Textbox(label='Greeting')\n)\ndemo.launch()"}],"quickstart":{"code":"import gradio as gr\n\n# Simple Interface\ndef classify_text(text):\n    return {'positive': 0.8, 'negative': 0.2}\n\ngr.Interface(\n    fn=classify_text,\n    inputs=gr.Textbox(label='Input Text'),\n    outputs=gr.Label(label='Sentiment')\n).launch()\n\n\n# Blocks API (more flexible)\ndef chat(message, history):\n    # history is list of dicts: [{role, content}, ...]\n    response = f'Echo: {message}'\n    return response\n\nwith gr.Blocks() as demo:\n    gr.Markdown('# My Chatbot')\n    chatbot = gr.Chatbot(type='messages')  # dict format required in 6.0\n    msg = gr.Textbox(label='Message')\n    btn = gr.Button('Send')\n    \n    def respond(message, history):\n        history.append({'role': 'user', 'content': message})\n        history.append({'role': 'assistant', 'content': f'Echo: {message}'})\n        return '', history\n    \n    btn.click(respond, [msg, chatbot], [msg, chatbot])\n\ndemo.launch(share=True)","lang":"python","description":"6.x API. Use type='messages' for gr.Chatbot. Return component instances, not gr.update()."},"warnings":[{"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)","message":"gr.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.","severity":"breaking","affected_versions":">= 4.0"},{"fix":"Use type='messages' in gr.Chatbot(type='messages'). Format history as: [{'role': 'user', 'content': msg}, {'role': 'assistant', 'content': response}]","message":"Chatbot 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': '...'}]","severity":"breaking","affected_versions":">= 6.0"},{"fix":"Pass theme at the app level instead: demo = gr.Blocks(); demo.theme = gr.themes.Soft(). Or use theme in gr.Interface(theme=...).","message":"theme= 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()).","severity":"breaking","affected_versions":">= 6.0"},{"fix":"Replace: demo.queue(concurrency_count=5) with per-event: btn.click(fn, ..., concurrency_limit=5). For unlimited: concurrency_limit=None.","message":"concurrency_count parameter removed in Gradio 4.0. Per-event concurrency_limit replaced it. queue=False also removed — use concurrency_limit=None instead.","severity":"breaking","affected_versions":">= 4.0"},{"fix":"Save output files to tempfile.NamedTemporaryFile() or the current working directory. Return the path from tempfile.","message":"In 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.","severity":"breaking","affected_versions":">= 5.0"},{"fix":"Upgrade to Python 3.10+. Pin gradio<5.0 for Python 3.9 environments.","message":"Python 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+.","severity":"gotcha","affected_versions":">= 5.0"},{"fix":"When using AI to generate Gradio code, explicitly prompt: 'Use Gradio 6.x API — no gr.update(), use messages dict format for Chatbot.'","message":"LLMs (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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-12T12:13:34.623Z","next_check":"2026-06-27T00:00:00.000Z","problems":[{"fix":"Instead of calling `.update()`, return a new instance of the component from your function with the desired properties. For example, `gr.Textbox(value='New text')` instead of `gr.Textbox().update(value='New text')`.","cause":"The `gr.update()` method and `component.update()` methods were removed in Gradio 4.0. Components are now updated by directly returning a new instance of the component with the desired changes.","error":"AttributeError: type object 'Component' has no attribute 'update'"},{"fix":"Migrate your chatbot history and examples to the messages format. Each message should be a dictionary like `{'role': 'user', 'content': 'Hello'}` or `{'role': 'assistant', 'content': 'Hi there!'}`. For `gr.Chatbot` you can also explicitly set `type='messages'` if it's not the default.","cause":"Gradio 6.0 removed the tuple format for `gr.Chatbot` and `gr.ChatInterface` history and examples. The new format requires a list of dictionaries, each containing 'role' and 'content' keys, aligning with OpenAI's message format.","error":"UserWarning: The 'tuples' format for chatbot messages is deprecated and will be removed in a future version of Gradio. Please set type='messages' instead, which uses openai-style 'role' and 'content' keys."},{"fix":"Ensure Gradio is installed in your active Python environment by running `pip install gradio`. If using virtual environments, activate the correct one before installing or running your script. If multiple Python installations exist, ensure you're using the correct `python` executable.","cause":"The Gradio library is not installed in the currently active Python environment, or there is a conflict with multiple Python installations/virtual environments.","error":"ModuleNotFoundError: No module named 'gradio'"},{"fix":"Ensure all chat history and new messages returned by your function are in the dictionary format `[{'role': 'user', 'content': '...'}]` or `ChatMessage` objects, not tuples.","cause":"This error occurs in Gradio 6.x when a `gr.Chatbot` or `gr.ChatInterface` is configured for the 'messages' format (which is now the default) but receives chat history or new messages in the older tuple format `[user_message, assistant_message]`.","error":"gradio.exceptions.Error: Data incompatible with messages format. Each message should be a dictionary with 'role' and 'content' keys or a ChatMessage object."},{"fix":"Rename your Python script file to something other than `gradio.py` (e.g., `app.py`, `my_gradio_app.py`).","cause":"This typically happens when your Python script file is named `gradio.py`. Python tries to import your file instead of the actual Gradio library, leading to a circular import and this `AttributeError`.","error":"AttributeError: partially initialized module 'gradio' has no attribute 'Interface' (most likely due to a circular import)"}],"ecosystem":"pypi","meta_description":null,"install_score":75,"install_tag":"reviewed","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"reviewed","tag_description":"minor failures on some runtimes or slightly older test data","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.85,"mem_mb":50.1,"disk_size":"290.0M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":8.02,"mem_mb":50.1,"disk_size":"284M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":15.61,"mem_mb":54.8,"disk_size":"312.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":13.12,"mem_mb":54.8,"disk_size":"305M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.78,"mem_mb":53.9,"disk_size":"295.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.62,"mem_mb":53.9,"disk_size":"289M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.28,"mem_mb":54.4,"disk_size":"295.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.47,"mem_mb":54.4,"disk_size":"288M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":-1},{"runtime":"python:3.10-slim","exit_code":-1},{"runtime":"python:3.11-alpine","exit_code":-1},{"runtime":"python:3.11-slim","exit_code":-1},{"runtime":"python:3.12-alpine","exit_code":-1},{"runtime":"python:3.12-slim","exit_code":-1},{"runtime":"python:3.13-alpine","exit_code":-1},{"runtime":"python:3.13-slim","exit_code":-1},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}