Spaces:
Running
Running
import gradio as gr | |
from registry import registry | |
def create_filter_controls(): | |
controls = {} | |
for filter_name in registry.filters: | |
params = registry.params_map.get(filter_name, {}) | |
with gr.Group(visible=filter_name == "Original") as group: # Create group here | |
filter_controls_list = [] | |
for param_name, config in params.items(): | |
if config['type'] == int: | |
slider = gr.Slider( | |
minimum=1, | |
maximum=100, | |
value=config['default'], | |
label=param_name.replace('_', ' ').title() | |
) | |
elif config['type'] == float: | |
slider = gr.Slider( | |
minimum=0.1, | |
maximum=10.0, | |
step=0.1, | |
value=config['default'], | |
label=param_name.replace('_', ' ').title() | |
) | |
filter_controls_list.append(slider) | |
controls[filter_name] = group # Store the group | |
for control in filter_controls_list: # Add controls to the group | |
group.children = group.children + [control] if group.children else [control] | |
return controls |