Seamless-Texture / docs /GRADIO6_MIGRATION.md
Maikeu Locatelli
Add initial implementation of Flux Seamless Texture LoRA application
f0d9a3e
|
Raw
History Blame Contribute Delete
2.49 kB
# 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):**
```python
with gr.Blocks(
theme=gr.themes.Soft(),
css=".my-class { color: red; }",
) as demo:
gr.Textbox(label="Input")
demo.launch()
```
**After (Gradio 6.x):**
```python
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:**
```python
demo.launch(show_api=False)
```
**After:**
```python
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:**
```python
btn.click(fn, show_api=False, api_name=False)
```
**After:**
```python
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
1. ✅ Moved theme and CSS from `Blocks()` to `launch()`
2. ✅ Replaced `show_api` with `footer_links`
3. ✅ Updated all event listeners to use `api_visibility` where needed
4. ✅ Updated `requirements.txt` to Gradio 6.x
5. ✅ Updated README.md metadata to `sdk_version: 6.0.0`
6. ✅ 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
## References
- [Gradio 6 Migration Guide](https://www.gradio.app/main/guides/gradio-6-migration-guide)
- [Gradio 6 Release Notes](https://github.com/gradio-app/gradio/releases)