Spaces:
Sleeping
Sleeping
francescoKrnl
commited on
Commit
•
d142887
1
Parent(s):
f4ab459
Update app.py
Browse files
app.py
CHANGED
@@ -27,8 +27,10 @@ def empty_input_image():
|
|
27 |
'layers': [Image.new("L", (512, 512), 255),Image.new("L", (512, 512), 255)],
|
28 |
'composite': Image.new("L", (512, 512), 255)}
|
29 |
|
30 |
-
def clear_sketchbox():
|
31 |
-
|
|
|
|
|
32 |
|
33 |
def pil_image_to_data_uri(img, format='PNG'):
|
34 |
buffered = BytesIO()
|
@@ -207,6 +209,6 @@ with gr.Blocks(css="style.css", head = head) as demo:
|
|
207 |
item.change(fn=run, inputs=inputs, outputs=outputs)
|
208 |
color.change(fn=run, inputs=inputs, outputs=outputs)
|
209 |
image.change(fn=run, inputs=inputs, outputs=outputs, trigger_mode="always_last")
|
210 |
-
image.clear(fn=clear_sketchbox, outputs=[image , color])
|
211 |
if __name__ == "__main__":
|
212 |
demo.queue().launch(debug=True, allowed_paths=["."])
|
|
|
27 |
'layers': [Image.new("L", (512, 512), 255),Image.new("L", (512, 512), 255)],
|
28 |
'composite': Image.new("L", (512, 512), 255)}
|
29 |
|
30 |
+
def clear_sketchbox(color_name):
|
31 |
+
temp_color_list = COLORS.copy()
|
32 |
+
temp_color_list..remove(color_name)
|
33 |
+
return [empty_input_image(), random.choice(temp_color_list)]
|
34 |
|
35 |
def pil_image_to_data_uri(img, format='PNG'):
|
36 |
buffered = BytesIO()
|
|
|
209 |
item.change(fn=run, inputs=inputs, outputs=outputs)
|
210 |
color.change(fn=run, inputs=inputs, outputs=outputs)
|
211 |
image.change(fn=run, inputs=inputs, outputs=outputs, trigger_mode="always_last")
|
212 |
+
image.clear(fn=clear_sketchbox, input=color, outputs=[image , color])
|
213 |
if __name__ == "__main__":
|
214 |
demo.queue().launch(debug=True, allowed_paths=["."])
|