Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,10 +26,11 @@ def create_app():
|
|
| 26 |
|
| 27 |
# Thêm các control vào UI
|
| 28 |
control_components = []
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
with group: # Put controls inside the group
|
| 32 |
-
for component in
|
| 33 |
control_components.append(component) # Collect sliders for event handling
|
| 34 |
|
| 35 |
with gr.Column():
|
|
@@ -40,7 +41,7 @@ def create_app():
|
|
| 40 |
updates = []
|
| 41 |
for group_name, group in filter_groups.items():
|
| 42 |
visibility = (group_name == filter_name)
|
| 43 |
-
updates.append(gr.
|
| 44 |
return updates
|
| 45 |
|
| 46 |
|
|
@@ -75,17 +76,11 @@ def create_app():
|
|
| 75 |
filter_select.change(
|
| 76 |
update_controls,
|
| 77 |
inputs=filter_select,
|
| 78 |
-
outputs=
|
| 79 |
)
|
| 80 |
|
| 81 |
input_components_process = [input_image, filter_select] + control_components
|
| 82 |
-
filter_select
|
| 83 |
-
process,
|
| 84 |
-
inputs=input_components_process,
|
| 85 |
-
outputs=output_image,
|
| 86 |
-
show_progress=False
|
| 87 |
-
)
|
| 88 |
-
for component in control_components: # Attach change to sliders
|
| 89 |
component.change(
|
| 90 |
process,
|
| 91 |
inputs=input_components_process,
|
|
|
|
| 26 |
|
| 27 |
# Thêm các control vào UI
|
| 28 |
control_components = []
|
| 29 |
+
for filter_name, control_list in controls.items():
|
| 30 |
+
group = gr.Group(visible=filter_name == "Original") # Create group here, outside with
|
| 31 |
+
filter_groups[filter_name] = group # Store group
|
| 32 |
with group: # Put controls inside the group
|
| 33 |
+
for component in control_list:
|
| 34 |
control_components.append(component) # Collect sliders for event handling
|
| 35 |
|
| 36 |
with gr.Column():
|
|
|
|
| 41 |
updates = []
|
| 42 |
for group_name, group in filter_groups.items():
|
| 43 |
visibility = (group_name == filter_name)
|
| 44 |
+
updates.append(gr.update(visible=visibility)) # Changed from gr.Group.update
|
| 45 |
return updates
|
| 46 |
|
| 47 |
|
|
|
|
| 76 |
filter_select.change(
|
| 77 |
update_controls,
|
| 78 |
inputs=filter_select,
|
| 79 |
+
outputs=list(filter_groups.values()) # Pass list of groups as outputs
|
| 80 |
)
|
| 81 |
|
| 82 |
input_components_process = [input_image, filter_select] + control_components
|
| 83 |
+
for component in [input_image, filter_select] + control_components: # Attach change to sliders
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
component.change(
|
| 85 |
process,
|
| 86 |
inputs=input_components_process,
|