Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ def random_hex():
|
|
8 |
|
9 |
# Generate initial 5-color palette
|
10 |
def generate_palette(locked_colors):
|
11 |
-
new_palette = [random_hex() if
|
12 |
return new_palette
|
13 |
|
14 |
# Create color swatches
|
@@ -27,7 +27,7 @@ initial_palette = generate_palette([None] * 5)
|
|
27 |
def update_palette(*locks):
|
28 |
locks = [color if color else None for color in locks]
|
29 |
new_palette = generate_palette(locks)
|
30 |
-
return display_palette(new_palette)
|
31 |
|
32 |
with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
33 |
gr.Markdown("# π¨ AI-Powered Color Palette Generator")
|
@@ -39,11 +39,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
39 |
palette_output = gr.Plot(label="Generated Palette")
|
40 |
generate_button = gr.Button("Regenerate Palette π¨")
|
41 |
|
42 |
-
generate_button.click(update_palette, inputs=lock_inputs, outputs=[palette_output
|
43 |
|
44 |
initial_fig, _ = display_palette(initial_palette)
|
45 |
palette_output.value = initial_fig
|
46 |
|
47 |
# Launch the app
|
48 |
if __name__ == "__main__":
|
49 |
-
iface.launch()
|
|
|
8 |
|
9 |
# Generate initial 5-color palette
|
10 |
def generate_palette(locked_colors):
|
11 |
+
new_palette = [random_hex() if locked is None else locked for locked in locked_colors]
|
12 |
return new_palette
|
13 |
|
14 |
# Create color swatches
|
|
|
27 |
def update_palette(*locks):
|
28 |
locks = [color if color else None for color in locks]
|
29 |
new_palette = generate_palette(locks)
|
30 |
+
return display_palette(new_palette) + tuple(new_palette)
|
31 |
|
32 |
with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
33 |
gr.Markdown("# π¨ AI-Powered Color Palette Generator")
|
|
|
39 |
palette_output = gr.Plot(label="Generated Palette")
|
40 |
generate_button = gr.Button("Regenerate Palette π¨")
|
41 |
|
42 |
+
generate_button.click(update_palette, inputs=lock_inputs, outputs=[palette_output] + lock_inputs)
|
43 |
|
44 |
initial_fig, _ = display_palette(initial_palette)
|
45 |
palette_output.value = initial_fig
|
46 |
|
47 |
# Launch the app
|
48 |
if __name__ == "__main__":
|
49 |
+
iface.launch()
|