ford442 commited on
Commit
0fb2ffa
·
verified ·
1 Parent(s): 57ec14c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -317,8 +317,11 @@ def generate_30(
317
  uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
318
  batch_options = options.copy()
319
  if freeu:
 
320
  register_free_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
321
  register_free_crossattn_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
 
 
322
  rv_image = pipe(**batch_options).images[0]
323
  sd_image_path = f"rv50_A_{timestamp}.png"
324
  rv_image.save(sd_image_path,optimize=False,compress_level=0)
@@ -381,8 +384,11 @@ def generate_60(
381
  uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
382
  batch_options = options.copy()
383
  if freeu:
 
384
  register_free_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
385
  register_free_crossattn_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
 
 
386
  rv_image = pipe(**batch_options).images[0]
387
  sd_image_path = f"rv50_A_{timestamp}.png"
388
  rv_image.save(sd_image_path,optimize=False,compress_level=0)
@@ -445,8 +451,11 @@ def generate_90(
445
  uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
446
  batch_options = options.copy()
447
  if freeu:
 
448
  register_free_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
449
  register_free_crossattn_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
 
 
450
  rv_image = pipe(**batch_options).images[0]
451
  sd_image_path = f"rv50_A_{timestamp}.png"
452
  rv_image.save(sd_image_path,optimize=False,compress_level=0)
 
317
  uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
318
  batch_options = options.copy()
319
  if freeu:
320
+ pipe.enable_freeu(s1,s2,b1,b2)
321
  register_free_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
322
  register_free_crossattn_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
323
+ else:
324
+ pipe.disable_freeu()
325
  rv_image = pipe(**batch_options).images[0]
326
  sd_image_path = f"rv50_A_{timestamp}.png"
327
  rv_image.save(sd_image_path,optimize=False,compress_level=0)
 
384
  uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
385
  batch_options = options.copy()
386
  if freeu:
387
+ pipe.enable_freeu(s1,s2,b1,b2)
388
  register_free_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
389
  register_free_crossattn_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
390
+ else:
391
+ pipe.disable_freeu()
392
  rv_image = pipe(**batch_options).images[0]
393
  sd_image_path = f"rv50_A_{timestamp}.png"
394
  rv_image.save(sd_image_path,optimize=False,compress_level=0)
 
451
  uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
452
  batch_options = options.copy()
453
  if freeu:
454
+ pipe.enable_freeu(s1,s2,b1,b2)
455
  register_free_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
456
  register_free_crossattn_upblock2d(pip, b1=b1, b2=b2, s1=s1, s2=s1)
457
+ else:
458
+ pipe.disable_freeu()
459
  rv_image = pipe(**batch_options).images[0]
460
  sd_image_path = f"rv50_A_{timestamp}.png"
461
  rv_image.save(sd_image_path,optimize=False,compress_level=0)