Sebastiankay commited on
Commit
5a1ae74
·
verified ·
1 Parent(s): d34cc01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -4
app.py CHANGED
@@ -318,8 +318,24 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
318
  with gr.Tab("Preprocessors"):
319
  with gr.Row(elem_classes="row-main"):
320
  with gr.Column(scale=1, elem_id="input_column", elem_classes="input-column"):
321
- input_image = gr.Image(label="Dein Bild", type="numpy")
 
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  ## TAB LINEART
324
  with gr.Tab("Lineart") as tab_lineart:
325
  with gr.Row():
@@ -346,6 +362,8 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
346
  with gr.Row():
347
  run_btn_lineart = gr.Button("Los", variant="primary", visible=True)
348
  run_btn_canny = gr.Button("Los", variant="primary", visible=False)
 
 
349
 
350
  all_run_btns = [run_btn_lineart, run_btn_canny]
351
 
@@ -357,8 +375,9 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
357
 
358
  return {"visible": lineart_btn_visible, "__type__": "update"}, {"visible": canny_btn_visible, "__type__": "update"}
359
 
360
- tab_lineart.select(fn=lambda: set_inputs("tab_lineart"), inputs=None, outputs=[run_btn_lineart, run_btn_canny])
361
- tab_canny.select(fn=lambda: set_inputs("tab_canny"), inputs=None, outputs=[run_btn_lineart, run_btn_canny])
 
362
 
363
  with gr.Column(scale=2):
364
  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")
@@ -375,7 +394,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, head=custom_head, titl
375
  # MARK: Button Runs
376
  run_btn_lineart.click(fn=lineart, inputs=[input_image, resolution, preprocessor_name, invert, gallery], outputs=[gallery])
377
  run_btn_canny.click(fn=canny, inputs=[input_image, resolution, low_threshold, high_threshold, gallery], outputs=[gallery])
378
-
379
 
380
  """
381
  with gr.Blocks(theme=theme, css="custom.css", js="javascript.js") as demo:
 
318
  with gr.Tab("Preprocessors"):
319
  with gr.Row(elem_classes="row-main"):
320
  with gr.Column(scale=1, elem_id="input_column", elem_classes="input-column"):
321
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
322
+
323
 
324
+ ## TAB OPENPOSE
325
+ with gr.Tab("Lineart") 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 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")
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():
 
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]
369
 
 
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
  # 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: