Spaces:
Running on Zero
Running on Zero
A newer version of the Gradio SDK is available: 6.22.0
Gradio 6 Migration Guide
This document details the migration from Gradio 5.16.2 to Gradio 6.x.
Breaking Changes Implemented
1. App-level Parameters Moved to launch()
Before (Gradio 5.x):
with gr.Blocks(
theme=gr.themes.Soft(),
css=".my-class { color: red; }",
) as demo:
gr.Textbox(label="Input")
demo.launch()
After (Gradio 6.x):
with gr.Blocks() as demo:
gr.Textbox(label="Input")
demo.launch(
theme=gr.themes.Soft(),
css=".my-class { color: red; }",
)
Reason: gr.Blocks can be nested and are not necessarily unique to a Gradio app, so app-level parameters are now in launch().
2. show_api Replaced with footer_links
Before:
demo.launch(show_api=False)
After:
demo.launch(footer_links=["gradio", "settings"]) # Without "api"
Mapping:
show_api=True→footer_links=["api", "gradio", "settings"](default)show_api=False→footer_links=["gradio", "settings"]
3. api_visibility in Event Listeners
Before:
btn.click(fn, show_api=False, api_name=False)
After:
btn.click(fn, api_visibility="private")
Options:
"public": Endpoint shown in API docs and accessible (default)"undocumented": Hidden from API docs but still accessible"private": Completely disabled and inaccessible
Changes Made in This Project
- ✅ Moved theme and CSS from
Blocks()tolaunch() - ✅ Replaced
show_apiwithfooter_links - ✅ Updated all event listeners to use
api_visibilitywhere needed - ✅ Updated
requirements.txtto Gradio 6.x - ✅ Updated README.md metadata to
sdk_version: 6.0.0 - ✅ Tested all components for compatibility
New Features in Gradio 6
- Improved performance and lighter weight
- Better customization options
- Enhanced theme system
- Native dark mode support
- Improved component APIs
Testing
All functionality has been tested with Gradio 6.x:
- ✅ Interface rendering
- ✅ Event listeners
- ✅ Component interactions
- ✅ Theme application
- ✅ API endpoints
Compatibility Notes
- Gradio 6 is backward compatible with most Gradio 5 code
- Some deprecated features have been removed
- New features provide better alternatives