lixiang46 commited on
Commit
78ad020
1 Parent(s): 51ff674
Files changed (1) hide show
  1. app.py +33 -5
app.py CHANGED
@@ -114,11 +114,14 @@ def infer(prompt,
114
  ).images[0]
115
  return [condi_img, image]
116
 
117
- examples = [
118
  ["一个漂亮的女孩,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
119
  "image/woman_1.png", "Canny"],
120
  ["全景,一只可爱的白色小狗坐在杯子里,看向镜头,动漫风格,3d渲染,辛烷值渲染",
121
- "image/dog.png", "Canny"],
 
 
 
122
  ["新海诚风格,丰富的色彩,穿着绿色衬衫的女人站在田野里,唯美风景,清新明亮,斑驳的光影,最好的质量,超细节,8K画质",
123
  "image/woman_2.png", "Depth"],
124
  ["一只颜色鲜艳的小鸟,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
@@ -155,7 +158,8 @@ with gr.Blocks(css=css) as Kolors:
155
  controlnet_type = gr.Dropdown(
156
  ["Depth", "Canny"],
157
  label = "Controlnet",
158
- value="Depth"
 
159
  )
160
  with gr.Row():
161
  image = gr.Image(label="Image", type="pil")
@@ -214,6 +218,9 @@ with gr.Blocks(css=css) as Kolors:
214
  )
215
  with gr.Row():
216
  run_button = gr.Button("Run")
 
 
 
217
 
218
  with gr.Column(elem_id="col-right"):
219
  result = gr.Gallery(label="Result", show_label=False, columns=2)
@@ -221,9 +228,18 @@ with gr.Blocks(css=css) as Kolors:
221
  with gr.Row():
222
  gr.Examples(
223
  fn = infer,
224
- examples = examples,
 
 
 
 
 
 
 
 
225
  inputs = [prompt, image, controlnet_type],
226
- outputs = [result]
 
227
  )
228
 
229
  run_button.click(
@@ -232,4 +248,16 @@ with gr.Blocks(css=css) as Kolors:
232
  outputs = [result]
233
  )
234
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  Kolors.queue().launch(debug=True)
 
114
  ).images[0]
115
  return [condi_img, image]
116
 
117
+ canny_examples = [
118
  ["一个漂亮的女孩,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
119
  "image/woman_1.png", "Canny"],
120
  ["全景,一只可爱的白色小狗坐在杯子里,看向镜头,动漫风格,3d渲染,辛烷值渲染",
121
+ "image/dog.png", "Canny"]
122
+ ]
123
+
124
+ depth_examples = [
125
  ["新海诚风格,丰富的色彩,穿着绿色衬衫的女人站在田野里,唯美风景,清新明亮,斑驳的光影,最好的质量,超细节,8K画质",
126
  "image/woman_2.png", "Depth"],
127
  ["一只颜色鲜艳的小鸟,高品质,超清晰,色彩鲜艳,超高分辨率,最佳品质,8k,高清,4K",
 
158
  controlnet_type = gr.Dropdown(
159
  ["Depth", "Canny"],
160
  label = "Controlnet",
161
+ value="Depth",
162
+ visible=False
163
  )
164
  with gr.Row():
165
  image = gr.Image(label="Image", type="pil")
 
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")
224
 
225
  with gr.Column(elem_id="col-right"):
226
  result = gr.Gallery(label="Result", show_label=False, columns=2)
 
228
  with gr.Row():
229
  gr.Examples(
230
  fn = infer,
231
+ examples = canny_examples,
232
+ inputs = [prompt, image, controlnet_type],
233
+ outputs = [result],
234
+ label = "Canny"
235
+ )
236
+ with gr.Row():
237
+ gr.Examples(
238
+ fn = infer,
239
+ examples = depth_examples,
240
  inputs = [prompt, image, controlnet_type],
241
+ outputs = [result],
242
+ label = "Depth"
243
  )
244
 
245
  run_button.click(
 
248
  outputs = [result]
249
  )
250
 
251
+ canny_button.click(
252
+ fn = infer,
253
+ inputs = [prompt, image, "Canny", negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, controlnet_conditioning_scale, control_guidance_end, strength],
254
+ outputs = [result]
255
+ )
256
+
257
+ depth_button.click(
258
+ fn = infer,
259
+ inputs = [prompt, image, "Depth", negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, controlnet_conditioning_scale, control_guidance_end, strength],
260
+ outputs = [result]
261
+ )
262
+
263
  Kolors.queue().launch(debug=True)