Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,18 @@ def normalbae(img, res):
|
|
100 |
return [result]
|
101 |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
model_openpose = None
|
104 |
|
105 |
|
@@ -314,6 +326,18 @@ with block:
|
|
314 |
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
315 |
run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
|
316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
gr.Markdown("<hr>")
|
318 |
with gr.Row():
|
319 |
gr.Markdown("## Openpose")
|
|
|
100 |
return [result]
|
101 |
|
102 |
|
103 |
+
model_dwpose = None
|
104 |
+
|
105 |
+
def dwpose(img, res):
|
106 |
+
img = resize_image(HWC3(img), res)
|
107 |
+
global model_dwpose
|
108 |
+
if model_dwpose is None:
|
109 |
+
from annotator.dwpose import DWposeDetector
|
110 |
+
model_dwpose = DWposeDetector()
|
111 |
+
result = model_dwpose(img)
|
112 |
+
return [result]
|
113 |
+
|
114 |
+
|
115 |
model_openpose = None
|
116 |
|
117 |
|
|
|
326 |
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
327 |
run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
|
328 |
|
329 |
+
gr.Markdown("<hr>")
|
330 |
+
with gr.Row():
|
331 |
+
gr.Markdown("## DWPose")
|
332 |
+
with gr.Row():
|
333 |
+
with gr.Column():
|
334 |
+
input_image = gr.Image(source='upload', type="numpy")
|
335 |
+
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
336 |
+
run_button = gr.Button(label="Run")
|
337 |
+
with gr.Column():
|
338 |
+
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
339 |
+
run_button.click(fn=dwpose, inputs=[input_image, resolution], outputs=[gallery])
|
340 |
+
|
341 |
gr.Markdown("<hr>")
|
342 |
with gr.Row():
|
343 |
gr.Markdown("## Openpose")
|