Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -39,6 +39,15 @@ async (pose) => {
|
|
39 |
poseMakerEl.setPose(pose);
|
40 |
}
|
41 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
def generate_images(canvas):
|
43 |
base64_img = canvas
|
44 |
image_data = base64.b64decode(base64_img.split(',')[1])
|
@@ -50,8 +59,6 @@ def generate_images(canvas):
|
|
50 |
def placeholder_fn(axis):
|
51 |
pass
|
52 |
|
53 |
-
|
54 |
-
|
55 |
with gr.Blocks() as b:
|
56 |
with gr.Row():
|
57 |
canvas = gr.HTML(canvas_html, elem_id="canvas_html", visible=True)
|
@@ -59,6 +66,7 @@ with gr.Blocks() as b:
|
|
59 |
rotation_axis = gr.Radio(choices=["x", "y", "z"], value="x", label="Joint rotation axis")
|
60 |
pose_template = gr.Radio(choices=["regular", "ballet", "handstand", "split", "kick", "chilling"], value="regular", label="Pose template")
|
61 |
run_button = gr.Button("Generate")
|
|
|
62 |
|
63 |
rotation_axis.change(fn=placeholder_fn,
|
64 |
inputs=[rotation_axis],
|
@@ -72,7 +80,7 @@ with gr.Blocks() as b:
|
|
72 |
_js=js_pose_template)
|
73 |
run_button.click(fn=generate_images,
|
74 |
inputs=[canvas],
|
75 |
-
outputs=[
|
76 |
_js=get_js_image)
|
77 |
b.load(None,None,None,_js=load_js)
|
78 |
|
|
|
39 |
poseMakerEl.setPose(pose);
|
40 |
}
|
41 |
"""
|
42 |
+
def get_canny_filter(image):
|
43 |
+
if not isinstance(image, np.ndarray):
|
44 |
+
image = np.array(image)
|
45 |
+
|
46 |
+
image = cv2.Canny(image, low_threshold, high_threshold)
|
47 |
+
image = image[:, :, None]
|
48 |
+
image = np.concatenate([image, image, image], axis=2)
|
49 |
+
canny_image = Image.fromarray(image)
|
50 |
+
return canny_image
|
51 |
def generate_images(canvas):
|
52 |
base64_img = canvas
|
53 |
image_data = base64.b64decode(base64_img.split(',')[1])
|
|
|
59 |
def placeholder_fn(axis):
|
60 |
pass
|
61 |
|
|
|
|
|
62 |
with gr.Blocks() as b:
|
63 |
with gr.Row():
|
64 |
canvas = gr.HTML(canvas_html, elem_id="canvas_html", visible=True)
|
|
|
66 |
rotation_axis = gr.Radio(choices=["x", "y", "z"], value="x", label="Joint rotation axis")
|
67 |
pose_template = gr.Radio(choices=["regular", "ballet", "handstand", "split", "kick", "chilling"], value="regular", label="Pose template")
|
68 |
run_button = gr.Button("Generate")
|
69 |
+
out_im = gr.Image()
|
70 |
|
71 |
rotation_axis.change(fn=placeholder_fn,
|
72 |
inputs=[rotation_axis],
|
|
|
80 |
_js=js_pose_template)
|
81 |
run_button.click(fn=generate_images,
|
82 |
inputs=[canvas],
|
83 |
+
outputs=[out_im)],
|
84 |
_js=get_js_image)
|
85 |
b.load(None,None,None,_js=load_js)
|
86 |
|