Sebastiankay commited on
Commit
ac7da7c
·
verified ·
1 Parent(s): c998da9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -327,9 +327,9 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
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 and Face', 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")
@@ -360,9 +360,9 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
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", variant="primary", visible=True)
364
- run_btn_canny = gr.Button("Los", variant="primary", visible=False)
365
- run_button_openpose = gr.Button("Los", variant="primary", visible=True)
366
 
367
 
368
  all_run_btns = [run_btn_lineart, run_btn_canny]
@@ -372,12 +372,13 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
372
  # global input_options
373
  lineart_btn_visible = True if tab == "tab_lineart" else False
374
  canny_btn_visible = True if tab == "tab_canny" else False
 
375
 
376
- return {"visible": lineart_btn_visible, "__type__": "update"}, {"visible": canny_btn_visible, "__type__": "update"}
377
 
378
- tab_lineart.select(fn=lambda: set_inputs("tab_lineart"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_button_openpose])
379
- tab_canny.select(fn=lambda: set_inputs("tab_canny"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_button_openpose])
380
- tab_openpose.select(fn=lambda: set_inputs("tab_openpose"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_button_openpose])
381
 
382
  with gr.Column(scale=2):
383
  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")
@@ -394,7 +395,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
394
  # MARK: Button Runs
395
  run_btn_lineart.click(fn=lineart, inputs=[input_image, resolution, preprocessor_name, invert, gallery], outputs=[gallery])
396
  run_btn_canny.click(fn=canny, inputs=[input_image, resolution, low_threshold, high_threshold, gallery], outputs=[gallery])
397
- run_button_openpose.click(fn=openpose, inputs=[input_image, resolution, hand_and_face], outputs=[gallery])
398
 
399
  """
400
  with gr.Blocks(theme=theme, css="custom.css", js="javascript.js") as demo:
 
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")
 
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]
 
372
  # global input_options
373
  lineart_btn_visible = True if tab == "tab_lineart" else False
374
  canny_btn_visible = True if tab == "tab_canny" else False
375
+ openpose_btn_visible = True if tab == "tab_openpose" else False
376
 
377
+ return {"visible": lineart_btn_visible, "__type__": "update"}, {"visible": canny_btn_visible, "__type__": "update"}, {"visible": openpose_btn_visible, "__type__": "update"}
378
 
379
+ tab_lineart.select(fn=lambda: set_inputs("tab_lineart"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_button_openpose])
380
+ tab_canny.select(fn=lambda: set_inputs("tab_canny"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_button_openpose])
381
+ tab_openpose.select(fn=lambda: set_inputs("tab_openpose"), inputs=None, outputs=[run_btn_lineart, run_btn_canny, run_button_openpose])
382
 
383
  with gr.Column(scale=2):
384
  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")
 
395
  # MARK: Button Runs
396
  run_btn_lineart.click(fn=lineart, inputs=[input_image, resolution, preprocessor_name, invert, gallery], outputs=[gallery])
397
  run_btn_canny.click(fn=canny, inputs=[input_image, resolution, low_threshold, high_threshold, gallery], outputs=[gallery])
398
+ run_btn_openpose.click(fn=openpose, inputs=[input_image, resolution, hand_and_face], outputs=[gallery])
399
 
400
  """
401
  with gr.Blocks(theme=theme, css="custom.css", js="javascript.js") as demo: