Spaces:
Running
on
Zero
Running
on
Zero
zhiweili
commited on
Commit
•
05649e7
1
Parent(s):
bca475d
test control img2img
Browse files- app_haircolor_img2img.py +4 -4
app_haircolor_img2img.py
CHANGED
@@ -74,7 +74,7 @@ def image_to_image(
|
|
74 |
seed: int,
|
75 |
num_steps: int,
|
76 |
guidance_scale: float,
|
77 |
-
|
78 |
generate_size: int,
|
79 |
cond_scale1: float = 1.2,
|
80 |
cond_scale2: float = 1.2,
|
@@ -97,7 +97,7 @@ def image_to_image(
|
|
97 |
height=generate_size,
|
98 |
width=generate_size,
|
99 |
guidance_scale=guidance_scale,
|
100 |
-
|
101 |
num_inference_steps=num_steps,
|
102 |
controlnet_conditioning_scale=[cond_scale1, cond_scale2],
|
103 |
).images[0]
|
@@ -137,7 +137,7 @@ def create_demo() -> gr.Blocks:
|
|
137 |
with gr.Column():
|
138 |
num_steps = gr.Slider(minimum=1, maximum=100, value=20, step=1, label="Num Steps")
|
139 |
guidance_scale = gr.Slider(minimum=0, maximum=30, value=5, step=0.5, label="Guidance Scale")
|
140 |
-
|
141 |
with gr.Column():
|
142 |
with gr.Accordion("Advanced Options", open=False):
|
143 |
mask_expansion = gr.Number(label="Mask Expansion", value=50, visible=True)
|
@@ -164,7 +164,7 @@ def create_demo() -> gr.Blocks:
|
|
164 |
outputs=[origin_area_image, croper],
|
165 |
).success(
|
166 |
fn=image_to_image,
|
167 |
-
inputs=[origin_area_image, edit_prompt,seed, num_steps, guidance_scale,
|
168 |
outputs=[generated_image, generated_cost],
|
169 |
).success(
|
170 |
fn=restore_result,
|
|
|
74 |
seed: int,
|
75 |
num_steps: int,
|
76 |
guidance_scale: float,
|
77 |
+
strength: float,
|
78 |
generate_size: int,
|
79 |
cond_scale1: float = 1.2,
|
80 |
cond_scale2: float = 1.2,
|
|
|
97 |
height=generate_size,
|
98 |
width=generate_size,
|
99 |
guidance_scale=guidance_scale,
|
100 |
+
strength=strength,
|
101 |
num_inference_steps=num_steps,
|
102 |
controlnet_conditioning_scale=[cond_scale1, cond_scale2],
|
103 |
).images[0]
|
|
|
137 |
with gr.Column():
|
138 |
num_steps = gr.Slider(minimum=1, maximum=100, value=20, step=1, label="Num Steps")
|
139 |
guidance_scale = gr.Slider(minimum=0, maximum=30, value=5, step=0.5, label="Guidance Scale")
|
140 |
+
strength = gr.Slider(minimum=0, maximum=3, value=0.2, step=0.1, label="Strength")
|
141 |
with gr.Column():
|
142 |
with gr.Accordion("Advanced Options", open=False):
|
143 |
mask_expansion = gr.Number(label="Mask Expansion", value=50, visible=True)
|
|
|
164 |
outputs=[origin_area_image, croper],
|
165 |
).success(
|
166 |
fn=image_to_image,
|
167 |
+
inputs=[origin_area_image, edit_prompt,seed, num_steps, guidance_scale, strength, generate_size, cond_scale1, cond_scale2],
|
168 |
outputs=[generated_image, generated_cost],
|
169 |
).success(
|
170 |
fn=restore_result,
|