Update app.py
Browse files
app.py
CHANGED
@@ -321,21 +321,6 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
|
|
321 |
input_image = gr.Image(label="Input Image", type="numpy", height=512)
|
322 |
|
323 |
|
324 |
-
## TAB OPENPOSE
|
325 |
-
with gr.Tab("Openpose") as tab_openpose:
|
326 |
-
with gr.Row():
|
327 |
-
with gr.Column():
|
328 |
-
# # input_image = gr.Image(source='upload', type="numpy")
|
329 |
-
# input_image = gr.Image(label="Input Image", type="numpy", height=512)
|
330 |
-
hand_and_face = gr.Checkbox(label='Hand und Gesicht', value=False)
|
331 |
-
# resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
332 |
-
# run_button = gr.Button("Run")
|
333 |
-
# run_button = gr.Button(label="Run")
|
334 |
-
# with gr.Column():
|
335 |
-
# gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
336 |
-
# gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
|
337 |
-
# run_button.click(fn=openpose, inputs=[input_image, resolution, hand_and_face], outputs=[gallery])
|
338 |
-
|
339 |
## TAB LINEART
|
340 |
with gr.Tab("Lineart") as tab_lineart:
|
341 |
with gr.Row():
|
@@ -349,33 +334,38 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
|
|
349 |
|
350 |
## TAB Canny
|
351 |
with gr.Tab("Canny Edge") as tab_canny:
|
352 |
-
# with gr.Row():
|
353 |
-
# gr.Markdown("## Canny Edge")
|
354 |
with gr.Row():
|
355 |
with gr.Column():
|
356 |
|
357 |
low_threshold = gr.Slider(label="niedriger Schwellenwert", minimum=1, maximum=255, value=100, step=1)
|
358 |
high_threshold = gr.Slider(label="hoher Schwellenwert", minimum=1, maximum=255, value=200, step=1)
|
359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
with gr.Row():
|
361 |
resolution = gr.Slider(label="Auflösung (Pixel Breiet)", minimum=256, maximum=1024, value=512, step=64)
|
|
|
362 |
with gr.Row():
|
363 |
run_btn_lineart = gr.Button("Los (Lineart)", variant="primary", visible=True)
|
364 |
run_btn_canny = gr.Button("Los (Canny)", variant="primary", visible=False)
|
365 |
run_btn_openpose = gr.Button("Los (OpenPose)", variant="primary", visible=False)
|
366 |
|
367 |
|
368 |
-
all_run_btns = [run_btn_lineart, run_btn_canny]
|
369 |
|
370 |
def set_inputs(tab):
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
tab_lineart.select(fn=lambda: set_inputs("tab_lineart"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_btn_openpose])
|
380 |
tab_canny.select(fn=lambda: set_inputs("tab_canny"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_btn_openpose])
|
381 |
tab_openpose.select(fn=lambda: set_inputs("tab_openpose"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_btn_openpose])
|
|
|
321 |
input_image = gr.Image(label="Input Image", type="numpy", height=512)
|
322 |
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
## TAB LINEART
|
325 |
with gr.Tab("Lineart") as tab_lineart:
|
326 |
with gr.Row():
|
|
|
334 |
|
335 |
## TAB Canny
|
336 |
with gr.Tab("Canny Edge") as tab_canny:
|
|
|
|
|
337 |
with gr.Row():
|
338 |
with gr.Column():
|
339 |
|
340 |
low_threshold = gr.Slider(label="niedriger Schwellenwert", minimum=1, maximum=255, value=100, step=1)
|
341 |
high_threshold = gr.Slider(label="hoher Schwellenwert", minimum=1, maximum=255, value=200, step=1)
|
342 |
|
343 |
+
## TAB OPENPOSE
|
344 |
+
with gr.Tab("Openpose") as tab_openpose:
|
345 |
+
with gr.Row():
|
346 |
+
with gr.Column():
|
347 |
+
hand_and_face = gr.Checkbox(label='Hand und Gesicht', value=False)
|
348 |
+
|
349 |
+
|
350 |
with gr.Row():
|
351 |
resolution = gr.Slider(label="Auflösung (Pixel Breiet)", minimum=256, maximum=1024, value=512, step=64)
|
352 |
+
|
353 |
with gr.Row():
|
354 |
run_btn_lineart = gr.Button("Los (Lineart)", variant="primary", visible=True)
|
355 |
run_btn_canny = gr.Button("Los (Canny)", variant="primary", visible=False)
|
356 |
run_btn_openpose = gr.Button("Los (OpenPose)", variant="primary", visible=False)
|
357 |
|
358 |
|
359 |
+
all_run_btns = [run_btn_lineart, run_btn_canny, run_btn_openpose]
|
360 |
|
361 |
def set_inputs(tab):
|
362 |
+
tabs = {
|
363 |
+
"tab_lineart": [True, False, False],
|
364 |
+
"tab_canny": [False, True, False],
|
365 |
+
"tab_openpose": [False, False, True]
|
366 |
+
}
|
367 |
+
return [ {"visible": visible, "__type__": "update"} for visible in tabs.get(tab, [False, False, False]) ]
|
368 |
+
|
|
|
369 |
tab_lineart.select(fn=lambda: set_inputs("tab_lineart"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_btn_openpose])
|
370 |
tab_canny.select(fn=lambda: set_inputs("tab_canny"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_btn_openpose])
|
371 |
tab_openpose.select(fn=lambda: set_inputs("tab_openpose"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_btn_openpose])
|