Update app.py
Browse files
app.py
CHANGED
@@ -434,11 +434,18 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
434 |
invert = gr.Checkbox(label="Invert", value=True)
|
435 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
436 |
run_button = gr.Button("Lineart")
|
437 |
-
# run_button = gr.Button(label="Run")
|
438 |
with gr.Column():
|
439 |
gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
|
440 |
|
441 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
run_button.click(fn=lineart, inputs=[input_image, resolution, preprocessor_name, invert], outputs=[gallery])
|
443 |
|
444 |
with gr.Tab("InPaint"):
|
@@ -446,13 +453,12 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
446 |
gr.Markdown("## InPaint")
|
447 |
with gr.Row():
|
448 |
with gr.Column():
|
449 |
-
# input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
|
450 |
input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
|
451 |
invert = gr.Checkbox(label="Invert Mask", value=False)
|
452 |
run_button = gr.Button("Run")
|
453 |
-
|
454 |
with gr.Column():
|
455 |
-
|
456 |
gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
|
457 |
run_button.click(fn=inpaint, inputs=[input_image, invert], outputs=[gallery])
|
458 |
|
|
|
434 |
invert = gr.Checkbox(label="Invert", value=True)
|
435 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
436 |
run_button = gr.Button("Lineart")
|
|
|
437 |
with gr.Column():
|
438 |
gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
|
439 |
|
440 |
+
def update_button_label(preprocessor_name):
|
441 |
+
if preprocessor_name == "Lineart":
|
442 |
+
return "Lineart"
|
443 |
+
elif preprocessor_name == "Lineart Coarse":
|
444 |
+
return "Lineart Coarse"
|
445 |
+
elif preprocessor_name == "Lineart Anime":
|
446 |
+
return "Lineart Anime"
|
447 |
+
|
448 |
+
preprocessor_name.change(fn=update_button_label, inputs=[preprocessor_name], outputs=[run_button])
|
449 |
run_button.click(fn=lineart, inputs=[input_image, resolution, preprocessor_name, invert], outputs=[gallery])
|
450 |
|
451 |
with gr.Tab("InPaint"):
|
|
|
453 |
gr.Markdown("## InPaint")
|
454 |
with gr.Row():
|
455 |
with gr.Column():
|
|
|
456 |
input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
|
457 |
invert = gr.Checkbox(label="Invert Mask", value=False)
|
458 |
run_button = gr.Button("Run")
|
459 |
+
|
460 |
with gr.Column():
|
461 |
+
|
462 |
gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
|
463 |
run_button.click(fn=inpaint, inputs=[input_image, invert], outputs=[gallery])
|
464 |
|