Commit
·
c4df34b
1
Parent(s):
ea7f8c4
28. Sept. 2024, 12:36
Browse files
app.py
CHANGED
@@ -288,20 +288,31 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
288 |
)
|
289 |
with gr.Tab("Preprocessors"):
|
290 |
with gr.Row(elem_classes="row-main"):
|
291 |
-
with gr.Column(scale=1):
|
292 |
input_image = gr.Image(label="Input Image", type="numpy", height=512)
|
293 |
|
294 |
## TAB LINEART
|
295 |
with gr.Tab("Lineart"):
|
296 |
with gr.Row():
|
297 |
-
gr.Markdown("
|
298 |
with gr.Row():
|
299 |
with gr.Column():
|
300 |
preprocessor_name = gr.Radio(label="Preprocessor", show_label=False, choices=["Lineart", "Lineart Coarse", "Lineart Anime"], type="value", value="Lineart")
|
301 |
-
invert = gr.Checkbox(label="Invertiert", value=True)
|
302 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
303 |
run_btn_lineart = gr.Button("Run")
|
304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
with gr.Column(scale=2):
|
306 |
gallery = gr.Gallery(label="Generated images", show_label=False, interactive=False, format="png", elem_id="output_gallery", elem_classes="output-gallery", columns=[3], rows=[2], object_fit="contain", height="auto", type="filepath")
|
307 |
|
@@ -313,7 +324,10 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
313 |
# Das Tutorial kommt bald.
|
314 |
"""
|
315 |
)
|
|
|
|
|
316 |
run_btn_lineart.click(fn=lineart, inputs=[input_image, resolution, preprocessor_name, invert, gallery], outputs=[gallery])
|
|
|
317 |
|
318 |
|
319 |
"""
|
@@ -329,7 +343,7 @@ with gr.Blocks(theme=theme, css="custom.css", js="javascript.js") as demo:
|
|
329 |
low_threshold = gr.Slider(label="low_threshold", minimum=1, maximum=255, value=100, step=1)
|
330 |
high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
|
331 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
332 |
-
|
333 |
# run_button = gr.Button(label="Run")
|
334 |
with gr.Column():
|
335 |
# gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
|
|
288 |
)
|
289 |
with gr.Tab("Preprocessors"):
|
290 |
with gr.Row(elem_classes="row-main"):
|
291 |
+
with gr.Column(scale=1, elem_id="input_column", elem_classes="input-column"):
|
292 |
input_image = gr.Image(label="Input Image", type="numpy", height=512)
|
293 |
|
294 |
## TAB LINEART
|
295 |
with gr.Tab("Lineart"):
|
296 |
with gr.Row():
|
297 |
+
gr.Markdown("<p>Check Invert to use with Mochi Diffusion. Inverted image can also be created here for use with ControlNet Scribble.")
|
298 |
with gr.Row():
|
299 |
with gr.Column():
|
300 |
preprocessor_name = gr.Radio(label="Preprocessor", show_label=False, choices=["Lineart", "Lineart Coarse", "Lineart Anime"], type="value", value="Lineart")
|
301 |
+
invert = gr.Checkbox(label="Invertiert", value=True, elem_classes="toggle-btn")
|
302 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
303 |
run_btn_lineart = gr.Button("Run")
|
304 |
|
305 |
+
## TAB Canny
|
306 |
+
with gr.Tab("Canny Edge"):
|
307 |
+
with gr.Row():
|
308 |
+
gr.Markdown("## Canny Edge")
|
309 |
+
with gr.Row():
|
310 |
+
with gr.Column():
|
311 |
+
low_threshold = gr.Slider(label="low_threshold", minimum=1, maximum=255, value=100, step=1)
|
312 |
+
high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
|
313 |
+
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
314 |
+
run_btn_canny = gr.Button("Run")
|
315 |
+
|
316 |
with gr.Column(scale=2):
|
317 |
gallery = gr.Gallery(label="Generated images", show_label=False, interactive=False, format="png", elem_id="output_gallery", elem_classes="output-gallery", columns=[3], rows=[2], object_fit="contain", height="auto", type="filepath")
|
318 |
|
|
|
324 |
# Das Tutorial kommt bald.
|
325 |
"""
|
326 |
)
|
327 |
+
|
328 |
+
# MARK: Button Runs
|
329 |
run_btn_lineart.click(fn=lineart, inputs=[input_image, resolution, preprocessor_name, invert, gallery], outputs=[gallery])
|
330 |
+
run_btn_canny.click(fn=canny, inputs=[input_image, resolution, low_threshold, high_threshold, gallery], outputs=[gallery])
|
331 |
|
332 |
|
333 |
"""
|
|
|
343 |
low_threshold = gr.Slider(label="low_threshold", minimum=1, maximum=255, value=100, step=1)
|
344 |
high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
|
345 |
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
346 |
+
run_btn_canny = gr.Button("Run")
|
347 |
# run_button = gr.Button(label="Run")
|
348 |
with gr.Column():
|
349 |
# gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|