Spaces:
Runtime error
Runtime error
Accept canny directly, not image
Browse files
app.py
CHANGED
@@ -53,14 +53,7 @@ def infer(
|
|
53 |
progress=gr.Progress(track_tqdm=True)
|
54 |
):
|
55 |
# Canny preprocessing
|
56 |
-
|
57 |
-
image_to_canny = np.array(image_to_canny)
|
58 |
-
image_to_canny = cv2.Canny(image_to_canny, low_threshold, high_threshold)
|
59 |
-
image_to_canny = image_to_canny[:, :, None]
|
60 |
-
image_to_canny = np.concatenate([image_to_canny, image_to_canny, image_to_canny], axis=2)
|
61 |
-
image_to_canny = Image.fromarray(image_to_canny)
|
62 |
-
|
63 |
-
control_image = image_to_canny
|
64 |
|
65 |
# Infer
|
66 |
image = pipe(
|
@@ -104,11 +97,11 @@ with gr.Blocks(css=css) as demo:
|
|
104 |
with gr.Accordion("Advanced settings", open=False):
|
105 |
with gr.Column():
|
106 |
with gr.Row():
|
107 |
-
inference_steps = gr.Slider(label="Inference steps", minimum=1, maximum=
|
108 |
guidance_scale = gr.Slider(label="Guidance scale", minimum=1.0, maximum=10.0, step=0.1, value=7.0)
|
109 |
control_weight = gr.Slider(label="Control Weight", minimum=0.0, maximum=1.0, step=0.01, value=0.7)
|
110 |
-
low_threshold = gr.Slider(label="Canny Low Threshold", minimum=0, maximum=
|
111 |
-
high_threshold = gr.Slider(label="Canny High Threshold", minimum=0, maximum=
|
112 |
|
113 |
submit_canny_btn = gr.Button("Submit")
|
114 |
|
|
|
53 |
progress=gr.Progress(track_tqdm=True)
|
54 |
):
|
55 |
# Canny preprocessing
|
56 |
+
control_image = load_image(image_in)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
# Infer
|
59 |
image = pipe(
|
|
|
97 |
with gr.Accordion("Advanced settings", open=False):
|
98 |
with gr.Column():
|
99 |
with gr.Row():
|
100 |
+
inference_steps = gr.Slider(label="Inference steps", minimum=1, maximum=100, step=1, value=50)
|
101 |
guidance_scale = gr.Slider(label="Guidance scale", minimum=1.0, maximum=10.0, step=0.1, value=7.0)
|
102 |
control_weight = gr.Slider(label="Control Weight", minimum=0.0, maximum=1.0, step=0.01, value=0.7)
|
103 |
+
low_threshold = gr.Slider(label="Canny Low Threshold", minimum=0, maximum=2048, step=1, value=100)
|
104 |
+
high_threshold = gr.Slider(label="Canny High Threshold", minimum=0, maximum=2048, step=1, value=200)
|
105 |
|
106 |
submit_canny_btn = gr.Button("Submit")
|
107 |
|