Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,8 @@ from io import BytesIO
|
|
5 |
import numpy as np
|
6 |
import base64
|
7 |
canvas_html = '<div style="height:50%"><pose-maker/></div>'
|
8 |
-
|
|
|
9 |
load_js = """
|
10 |
async () => {
|
11 |
const url = "https://huggingface.co/datasets/mishig/gradio-components/raw/main/mannequinAll.js"
|
@@ -19,7 +20,6 @@ async () => {
|
|
19 |
});
|
20 |
}
|
21 |
"""
|
22 |
-
|
23 |
get_js_image = """
|
24 |
async (canvas, prompt) => {
|
25 |
const poseMakerEl = document.querySelector("pose-maker");
|
@@ -33,7 +33,6 @@ async (axis) => {
|
|
33 |
poseMakerEl.changeRotationAxis(axis);
|
34 |
}
|
35 |
"""
|
36 |
-
|
37 |
js_pose_template = """
|
38 |
async (pose) => {
|
39 |
const poseMakerEl = document.querySelector("pose-maker");
|
@@ -43,7 +42,6 @@ async (pose) => {
|
|
43 |
def get_canny_filter(image):
|
44 |
if not isinstance(image, np.ndarray):
|
45 |
image = np.array(image)
|
46 |
-
|
47 |
image = cv2.Canny(image, low_threshold, high_threshold)
|
48 |
image = image[:, :, None]
|
49 |
image = np.concatenate([image, image, image], axis=2)
|
@@ -59,7 +57,6 @@ def generate_images(canvas):
|
|
59 |
return input_image
|
60 |
def placeholder_fn(axis):
|
61 |
pass
|
62 |
-
|
63 |
with gr.Blocks() as b:
|
64 |
with gr.Row():
|
65 |
canvas = gr.HTML(canvas_html, elem_id="canvas_html", visible=True)
|
|
|
5 |
import numpy as np
|
6 |
import base64
|
7 |
canvas_html = '<div style="height:50%"><pose-maker/></div>'
|
8 |
+
low_threshold = 100
|
9 |
+
high_threshold = 200
|
10 |
load_js = """
|
11 |
async () => {
|
12 |
const url = "https://huggingface.co/datasets/mishig/gradio-components/raw/main/mannequinAll.js"
|
|
|
20 |
});
|
21 |
}
|
22 |
"""
|
|
|
23 |
get_js_image = """
|
24 |
async (canvas, prompt) => {
|
25 |
const poseMakerEl = document.querySelector("pose-maker");
|
|
|
33 |
poseMakerEl.changeRotationAxis(axis);
|
34 |
}
|
35 |
"""
|
|
|
36 |
js_pose_template = """
|
37 |
async (pose) => {
|
38 |
const poseMakerEl = document.querySelector("pose-maker");
|
|
|
42 |
def get_canny_filter(image):
|
43 |
if not isinstance(image, np.ndarray):
|
44 |
image = np.array(image)
|
|
|
45 |
image = cv2.Canny(image, low_threshold, high_threshold)
|
46 |
image = image[:, :, None]
|
47 |
image = np.concatenate([image, image, image], axis=2)
|
|
|
57 |
return input_image
|
58 |
def placeholder_fn(axis):
|
59 |
pass
|
|
|
60 |
with gr.Blocks() as b:
|
61 |
with gr.Row():
|
62 |
canvas = gr.HTML(canvas_html, elem_id="canvas_html", visible=True)
|