Update app.py
Browse files
app.py
CHANGED
|
@@ -112,10 +112,21 @@ def openpose(img, res, hand_and_face):
|
|
| 112 |
result = model_openpose(img, hand_and_face)
|
| 113 |
return [result]
|
| 114 |
|
|
|
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
|
|
|
|
|
|
| 118 |
|
|
|
|
| 119 |
#def uniformer(img, res):
|
| 120 |
# img = resize_image(HWC3(img), res)
|
| 121 |
# global model_uniformer
|
|
@@ -329,6 +340,18 @@ with block:
|
|
| 329 |
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
| 330 |
run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
|
| 331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
gr.Markdown("<hr>")
|
| 333 |
with gr.Row():
|
| 334 |
gr.Markdown("## Openpose")
|
|
|
|
| 112 |
result = model_openpose(img, hand_and_face)
|
| 113 |
return [result]
|
| 114 |
|
| 115 |
+
model_dwpose = None
|
| 116 |
|
| 117 |
+
def dwpose(img, res):
|
| 118 |
+
img = resize_image(HWC3(img), res)
|
| 119 |
+
global model_dwpose
|
| 120 |
+
if model_dwpose is None:
|
| 121 |
+
from annotator.dwpose import DWposeDetector
|
| 122 |
+
model_dwpose = DWposeDetector()
|
| 123 |
+
result = model_dwpose(img)
|
| 124 |
+
return [result]
|
| 125 |
|
| 126 |
+
|
| 127 |
+
#model_uniformer = None
|
| 128 |
|
| 129 |
+
|
| 130 |
#def uniformer(img, res):
|
| 131 |
# img = resize_image(HWC3(img), res)
|
| 132 |
# global model_uniformer
|
|
|
|
| 340 |
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
| 341 |
run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
|
| 342 |
|
| 343 |
+
gr.Markdown("<hr>")
|
| 344 |
+
with gr.Row():
|
| 345 |
+
gr.Markdown("## DWPose")
|
| 346 |
+
with gr.Row():
|
| 347 |
+
with gr.Column():
|
| 348 |
+
input_image = gr.Image(source='upload', type="numpy")
|
| 349 |
+
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
| 350 |
+
run_button = gr.Button(label="Run")
|
| 351 |
+
with gr.Column():
|
| 352 |
+
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
| 353 |
+
run_button.click(fn=dw_pose, inputs=[input_image, resolution], outputs=[gallery])
|
| 354 |
+
|
| 355 |
gr.Markdown("<hr>")
|
| 356 |
with gr.Row():
|
| 357 |
gr.Markdown("## Openpose")
|