Spaces:
Runtime error
Runtime error
lixiang46
commited on
Commit
•
fad18b4
1
Parent(s):
78ad020
update
Browse files
app.py
CHANGED
@@ -114,18 +114,21 @@ def infer(prompt,
|
|
114 |
).images[0]
|
115 |
return [condi_img, image]
|
116 |
|
|
|
|
|
|
|
117 |
canny_examples = [
|
118 |
["一个漂亮的女孩,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
|
119 |
-
"image/woman_1.png"
|
120 |
["全景,一只可爱的白色小狗坐在杯子里,看向镜头,动漫风格,3d渲染,辛烷值渲染",
|
121 |
-
"image/dog.png"
|
122 |
]
|
123 |
|
124 |
depth_examples = [
|
125 |
["新海诚风格,丰富的色彩,穿着绿色衬衫的女人站在田野里,唯美风景,清新明亮,斑驳的光影,最好的质量,超细节,8K画质",
|
126 |
-
"image/woman_2.png"
|
127 |
["一只颜色鲜艳的小鸟,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
|
128 |
-
"image/bird.png"
|
129 |
]
|
130 |
|
131 |
css="""
|
@@ -216,8 +219,6 @@ with gr.Blocks(css=css) as Kolors:
|
|
216 |
step=0.1,
|
217 |
value=1.0,
|
218 |
)
|
219 |
-
with gr.Row():
|
220 |
-
run_button = gr.Button("Run")
|
221 |
with gr.Row():
|
222 |
canny_button = gr.Button("Canny")
|
223 |
depth_button = gr.Button("Depth")
|
@@ -229,7 +230,7 @@ with gr.Blocks(css=css) as Kolors:
|
|
229 |
gr.Examples(
|
230 |
fn = infer,
|
231 |
examples = canny_examples,
|
232 |
-
inputs = [prompt, image
|
233 |
outputs = [result],
|
234 |
label = "Canny"
|
235 |
)
|
@@ -237,7 +238,7 @@ with gr.Blocks(css=css) as Kolors:
|
|
237 |
gr.Examples(
|
238 |
fn = infer,
|
239 |
examples = depth_examples,
|
240 |
-
inputs = [prompt, image
|
241 |
outputs = [result],
|
242 |
label = "Depth"
|
243 |
)
|
@@ -249,14 +250,22 @@ with gr.Blocks(css=css) as Kolors:
|
|
249 |
)
|
250 |
|
251 |
canny_button.click(
|
|
|
|
|
|
|
|
|
252 |
fn = infer,
|
253 |
-
inputs = [prompt, image,
|
254 |
outputs = [result]
|
255 |
)
|
256 |
|
257 |
depth_button.click(
|
|
|
|
|
|
|
|
|
258 |
fn = infer,
|
259 |
-
inputs = [prompt, image,
|
260 |
outputs = [result]
|
261 |
)
|
262 |
|
|
|
114 |
).images[0]
|
115 |
return [condi_img, image]
|
116 |
|
117 |
+
def change_type(type):
|
118 |
+
return type
|
119 |
+
|
120 |
canny_examples = [
|
121 |
["一个漂亮的女孩,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
|
122 |
+
"image/woman_1.png"],
|
123 |
["全景,一只可爱的白色小狗坐在杯子里,看向镜头,动漫风格,3d渲染,辛烷值渲染",
|
124 |
+
"image/dog.png"]
|
125 |
]
|
126 |
|
127 |
depth_examples = [
|
128 |
["新海诚风格,丰富的色彩,穿着绿色衬衫的女人站在田野里,唯美风景,清新明亮,斑驳的光影,最好的质量,超细节,8K画质",
|
129 |
+
"image/woman_2.png"],
|
130 |
["一只颜色鲜艳的小鸟,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
|
131 |
+
"image/bird.png"]
|
132 |
]
|
133 |
|
134 |
css="""
|
|
|
219 |
step=0.1,
|
220 |
value=1.0,
|
221 |
)
|
|
|
|
|
222 |
with gr.Row():
|
223 |
canny_button = gr.Button("Canny")
|
224 |
depth_button = gr.Button("Depth")
|
|
|
230 |
gr.Examples(
|
231 |
fn = infer,
|
232 |
examples = canny_examples,
|
233 |
+
inputs = [prompt, image],
|
234 |
outputs = [result],
|
235 |
label = "Canny"
|
236 |
)
|
|
|
238 |
gr.Examples(
|
239 |
fn = infer,
|
240 |
examples = depth_examples,
|
241 |
+
inputs = [prompt, image],
|
242 |
outputs = [result],
|
243 |
label = "Depth"
|
244 |
)
|
|
|
250 |
)
|
251 |
|
252 |
canny_button.click(
|
253 |
+
fn = change_type,
|
254 |
+
input = "Canny",
|
255 |
+
outputs = controlnet_type
|
256 |
+
).then(
|
257 |
fn = infer,
|
258 |
+
inputs = [prompt, image, controlnet_type, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, controlnet_conditioning_scale, control_guidance_end, strength],
|
259 |
outputs = [result]
|
260 |
)
|
261 |
|
262 |
depth_button.click(
|
263 |
+
fn = change_type,
|
264 |
+
input = "Depth",
|
265 |
+
outputs = controlnet_type
|
266 |
+
).then(
|
267 |
fn = infer,
|
268 |
+
inputs = [prompt, image, controlnet_type, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, controlnet_conditioning_scale, control_guidance_end, strength],
|
269 |
outputs = [result]
|
270 |
)
|
271 |
|