File size: 2,488 Bytes
f0d9a3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# 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)