Yaron Koresh commited on
Commit
2978198
·
verified ·
1 Parent(s): af91dd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -512,7 +512,6 @@ image_pipe = DiffusionPipeline.from_pretrained("ostris/Flex.1-alpha", torch_dtyp
512
  image_pipe.enable_model_cpu_offload()
513
  image_pipe.enable_vae_slicing()
514
  image_pipe.enable_vae_tiling()
515
- image_pipe.enable_sequential_cpu_offload()
516
 
517
  # functionality
518
 
@@ -673,14 +672,10 @@ def upscale_image(img,factor):
673
 
674
  return ret
675
 
676
- def all_pipes(pos,neg,artist,song,h,w):
677
 
678
- imgs = pipe_generate_image(pos,neg,h,w)
679
-
680
- for i in range(len(imgs)):
681
- imgs[i] = upscaler(imgs[i],upscale_factor=factor)
682
-
683
- return imgs
684
 
685
  google_translate_endpoint = "https://translate.google.com/m"
686
  language_codes = {
@@ -1333,9 +1328,9 @@ def handle_generation(artist,song,lyrics,h,w):
1333
  Negative: {neg}
1334
  """)
1335
 
1336
- img = all_pipes(pos,neg,pos_artist,pos_song,h,w)[0]
1337
 
1338
- labeled_img = add_song_cover_text(img,artist,song,h,w)
1339
  name = f'{generate_random_string(8)}.png'
1340
  labeled_img.save(name)
1341
 
@@ -1375,18 +1370,18 @@ if __name__ == "__main__":
1375
  width = gr.Slider(
1376
  label="Width (px)",
1377
  minimum=512,
1378
- maximum=3072,
1379
- step=256,
1380
- value=1536,
1381
  )
1382
 
1383
 
1384
  height = gr.Slider(
1385
  label="Height (px)",
1386
  minimum=512,
1387
- maximum=3072,
1388
- step=256,
1389
- value=1536,
1390
  )
1391
 
1392
  lyrics = gr.Textbox(
 
512
  image_pipe.enable_model_cpu_offload()
513
  image_pipe.enable_vae_slicing()
514
  image_pipe.enable_vae_tiling()
 
515
 
516
  # functionality
517
 
 
672
 
673
  return ret
674
 
675
+ def all_pipes(pos,neg,h,w):
676
 
677
+ img = pipe_generate_image(pos,neg,h,w)[0]
678
+ return img
 
 
 
 
679
 
680
  google_translate_endpoint = "https://translate.google.com/m"
681
  language_codes = {
 
1328
  Negative: {neg}
1329
  """)
1330
 
1331
+ img = all_pipes(pos,neg,h,w)[0]
1332
 
1333
+ labeled_img = add_song_cover_text(img,pos_artist,pos_song,h,w)
1334
  name = f'{generate_random_string(8)}.png'
1335
  labeled_img.save(name)
1336
 
 
1370
  width = gr.Slider(
1371
  label="Width (px)",
1372
  minimum=512,
1373
+ maximum=1536,
1374
+ step=64,
1375
+ value=1024,
1376
  )
1377
 
1378
 
1379
  height = gr.Slider(
1380
  label="Height (px)",
1381
  minimum=512,
1382
+ maximum=1536,
1383
+ step=64,
1384
+ value=1024,
1385
  )
1386
 
1387
  lyrics = gr.Textbox(