LiruiZhao commited on
Commit
f0d0ec8
1 Parent(s): 9a50f62
app.py CHANGED
@@ -165,7 +165,7 @@ def generate(
165
  randomize_cfg: bool,
166
  text_cfg_scale: float,
167
  image_cfg_scale: float,
168
- weather_hide_video: bool,
169
  decode_image_batch: int
170
  ):
171
  seed = random.randint(0, 100000) if randomize_seed else seed
@@ -226,9 +226,8 @@ def generate(
226
  edited_image = Image.fromarray(x_0.type(torch.uint8).cpu().numpy())
227
  edited_mask = Image.fromarray(x_1.type(torch.uint8).cpu().numpy())
228
 
229
-
230
  image_video_path = None
231
- if not weather_hide_video:
232
  image_video = []
233
 
234
  for i in range(0, len(image_list), decode_image_batch):
@@ -286,21 +285,21 @@ def generate(
286
  return [int(seed), text_cfg_scale, image_cfg_scale, edited_image, mix_image, edited_mask_copy, mask_video_path, image_video_path, input_image_copy, mix_result_with_red_mask]
287
 
288
  def reset():
289
- return [100, "Randomize Seed", 1372, "Fix CFG", 7.5, 1.5, None, None, None, None, None, None, None, "Hide Image Video", 10]
290
 
291
  def get_example():
292
  return [
293
- ["test/dufu.png", "black and white suit", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
294
- ["test/girl.jpeg", "reflective sunglasses", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
295
- ["test/road_sign.png", "stop sign", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
296
- ["test/dufu.png", "blue medical mask", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
297
- ["test/people_standing.png", "dark green pleated skirt", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
298
- ["test/girl.jpeg", "shiny golden crown", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
299
- ["test/dufu.png", "sunglasses", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
300
- ["test/girl.jpeg", "diamond necklace", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
301
- ["test/iron_man.jpg", "sunglasses", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
302
- ["test/girl.jpeg", "the queen's crown", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
303
- ["test/girl.jpeg", "gorgeous yellow gown", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
304
  ]
305
 
306
  with gr.Blocks(css="footer {visibility: hidden}") as demo:
@@ -348,20 +347,17 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
348
 
349
  with gr.Accordion('More outputs', open=False):
350
  with gr.Row():
351
- # 单选框 选择是否显示视频
352
- weather_hide_video = gr.Radio(
353
- ["Show Image Video", "Hide Image Video"],
354
- value="Hide Image Video",
355
  type="index",
356
- label="Dynamic Process",
357
- show_label=False,
358
  interactive=True,
359
  )
360
- # decode的batch size,最大为steps的值
361
  decode_image_batch = gr.Number(value=10, precision=0, label="Decode Image Batch (<steps)", interactive=True)
362
  with gr.Row():
363
- image_video = gr.Video(label="Real-time Image Output")
364
- mask_video = gr.Video(label="Real-time Mask Output")
365
  with gr.Row():
366
  original_image = gr.Image(label=f"Original Image", type="pil", interactive=False)
367
  edited_image = gr.Image(label=f"Output Image", type="pil", interactive=False)
@@ -388,7 +384,7 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
388
  randomize_cfg,
389
  text_cfg_scale,
390
  image_cfg_scale,
391
- weather_hide_video,
392
  decode_image_batch
393
  ],
394
  outputs=[seed, text_cfg_scale, image_cfg_scale, edited_image, mix_image, edited_mask, mask_video, image_video, original_image, mix_result_with_red_mask],
@@ -396,7 +392,7 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
396
  reset_button.click(
397
  fn=reset,
398
  inputs=[],
399
- outputs=[steps, randomize_seed, seed, randomize_cfg, text_cfg_scale, image_cfg_scale, edited_image, mix_image, edited_mask, mask_video, image_video, original_image, mix_result_with_red_mask, weather_hide_video, decode_image_batch],
400
  )
401
 
402
 
 
165
  randomize_cfg: bool,
166
  text_cfg_scale: float,
167
  image_cfg_scale: float,
168
+ weather_close_video: bool,
169
  decode_image_batch: int
170
  ):
171
  seed = random.randint(0, 100000) if randomize_seed else seed
 
226
  edited_image = Image.fromarray(x_0.type(torch.uint8).cpu().numpy())
227
  edited_mask = Image.fromarray(x_1.type(torch.uint8).cpu().numpy())
228
 
 
229
  image_video_path = None
230
+ if not weather_close_video:
231
  image_video = []
232
 
233
  for i in range(0, len(image_list), decode_image_batch):
 
285
  return [int(seed), text_cfg_scale, image_cfg_scale, edited_image, mix_image, edited_mask_copy, mask_video_path, image_video_path, input_image_copy, mix_result_with_red_mask]
286
 
287
  def reset():
288
+ return [100, "Randomize Seed", 1372, "Fix CFG", 7.5, 1.5, None, None, None, None, None, None, None, "Close Image Video", 10]
289
 
290
  def get_example():
291
  return [
292
+ ["example_images/dufu.png", "black and white suit", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
293
+ ["example_images/girl.jpeg", "reflective sunglasses", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
294
+ ["example_images/road_sign.png", "stop sign", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
295
+ ["example_images/dufu.png", "blue medical mask", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
296
+ ["example_images/people_standing.png", "dark green pleated skirt", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
297
+ ["example_images/girl.jpeg", "shiny golden crown", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
298
+ ["example_images/dufu.png", "sunglasses", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
299
+ ["example_images/girl.jpeg", "diamond necklace", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
300
+ ["example_images/iron_man.jpg", "sunglasses", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
301
+ ["example_images/girl.jpeg", "the queen's crown", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
302
+ ["example_images/girl.jpeg", "gorgeous yellow gown", 100, "Fix Seed", 1372, "Fix CFG", 7.5, 1.5],
303
  ]
304
 
305
  with gr.Blocks(css="footer {visibility: hidden}") as demo:
 
347
 
348
  with gr.Accordion('More outputs', open=False):
349
  with gr.Row():
350
+ weather_close_video = gr.Radio(
351
+ ["Show Image Video", "Close Image Video"],
352
+ value="Close Image Video",
 
353
  type="index",
354
+ label="Image Generation Process Selection ()",
 
355
  interactive=True,
356
  )
 
357
  decode_image_batch = gr.Number(value=10, precision=0, label="Decode Image Batch (<steps)", interactive=True)
358
  with gr.Row():
359
+ image_video = gr.Video(label="Image Video of Generation Process")
360
+ mask_video = gr.Video(label="Mask Video of Generation Process")
361
  with gr.Row():
362
  original_image = gr.Image(label=f"Original Image", type="pil", interactive=False)
363
  edited_image = gr.Image(label=f"Output Image", type="pil", interactive=False)
 
384
  randomize_cfg,
385
  text_cfg_scale,
386
  image_cfg_scale,
387
+ weather_close_video,
388
  decode_image_batch
389
  ],
390
  outputs=[seed, text_cfg_scale, image_cfg_scale, edited_image, mix_image, edited_mask, mask_video, image_video, original_image, mix_result_with_red_mask],
 
392
  reset_button.click(
393
  fn=reset,
394
  inputs=[],
395
+ outputs=[steps, randomize_seed, seed, randomize_cfg, text_cfg_scale, image_cfg_scale, edited_image, mix_image, edited_mask, mask_video, image_video, original_image, mix_result_with_red_mask, weather_close_video, decode_image_batch],
396
  )
397
 
398
 
{test → example_images}/dufu.png RENAMED
File without changes
{test → example_images}/girl.jpeg RENAMED
File without changes
{test → example_images}/iron_man.jpg RENAMED
File without changes
{test → example_images}/people_standing.png RENAMED
File without changes
{test → example_images}/road_sign.png RENAMED
File without changes