Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -365,7 +365,8 @@ def generate_30(
|
|
365 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
366 |
if latent_file is not None: # Check if a latent file is provided
|
367 |
sd_image_a = Image.open(latent_file.name).convert('RGB')
|
368 |
-
sd_image_a.resize((
|
|
|
369 |
caption=[]
|
370 |
caption_2=[]
|
371 |
#caption.append(captioner(sd_image_a))
|
@@ -374,7 +375,8 @@ def generate_30(
|
|
374 |
caption_2.append(captioning(sd_image_a))
|
375 |
if latent_file_2 is not None: # Check if a latent file is provided
|
376 |
sd_image_b = Image.open(latent_file_2.name).convert('RGB')
|
377 |
-
sd_image_b.resize((height,width), Image.LANCZOS)
|
|
|
378 |
#caption.append(captioner(sd_image_b))
|
379 |
caption.append(captioner2(sd_image_b))
|
380 |
#caption.append(captioner_3(sd_image_b))
|
@@ -383,7 +385,8 @@ def generate_30(
|
|
383 |
sd_image_b = None
|
384 |
if latent_file_3 is not None: # Check if a latent file is provided
|
385 |
sd_image_c = Image.open(latent_file_3.name).convert('RGB')
|
386 |
-
sd_image_c.resize((height,width), Image.LANCZOS)
|
|
|
387 |
#caption.append(captioner(sd_image_c))
|
388 |
caption.append(captioner2(sd_image_c))
|
389 |
#caption.append(captioner_3(sd_image_c))
|
@@ -392,7 +395,8 @@ def generate_30(
|
|
392 |
sd_image_c = None
|
393 |
if latent_file_4 is not None: # Check if a latent file is provided
|
394 |
sd_image_d = Image.open(latent_file_4.name).convert('RGB')
|
395 |
-
sd_image_d.resize((height,width), Image.LANCZOS)
|
|
|
396 |
#caption.append(captioner(sd_image_d))
|
397 |
caption.append(captioner2(sd_image_d))
|
398 |
#caption.append(captioner_3(sd_image_d))
|
@@ -401,7 +405,8 @@ def generate_30(
|
|
401 |
sd_image_d = None
|
402 |
if latent_file_5 is not None: # Check if a latent file is provided
|
403 |
sd_image_e = Image.open(latent_file_5.name).convert('RGB')
|
404 |
-
sd_image_e.resize((height,width), Image.LANCZOS)
|
|
|
405 |
#caption.append(captioner(sd_image_e))
|
406 |
caption.append(captioner2(sd_image_e))
|
407 |
#caption.append(captioner_3(sd_image_e))
|
@@ -517,7 +522,8 @@ def generate_60(
|
|
517 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
518 |
if latent_file is not None: # Check if a latent file is provided
|
519 |
sd_image_a = Image.open(latent_file.name).convert('RGB')
|
520 |
-
sd_image_a.resize((
|
|
|
521 |
caption=[]
|
522 |
caption_2=[]
|
523 |
#caption.append(captioner(sd_image_a))
|
@@ -526,7 +532,8 @@ def generate_60(
|
|
526 |
caption_2.append(captioning(sd_image_a))
|
527 |
if latent_file_2 is not None: # Check if a latent file is provided
|
528 |
sd_image_b = Image.open(latent_file_2.name).convert('RGB')
|
529 |
-
sd_image_b.resize((height,width), Image.LANCZOS)
|
|
|
530 |
#caption.append(captioner(sd_image_b))
|
531 |
caption.append(captioner2(sd_image_b))
|
532 |
#caption.append(captioner_3(sd_image_b))
|
@@ -535,7 +542,8 @@ def generate_60(
|
|
535 |
sd_image_b = None
|
536 |
if latent_file_3 is not None: # Check if a latent file is provided
|
537 |
sd_image_c = Image.open(latent_file_3.name).convert('RGB')
|
538 |
-
sd_image_c.resize((height,width), Image.LANCZOS)
|
|
|
539 |
#caption.append(captioner(sd_image_c))
|
540 |
caption.append(captioner2(sd_image_c))
|
541 |
#caption.append(captioner_3(sd_image_c))
|
@@ -544,7 +552,8 @@ def generate_60(
|
|
544 |
sd_image_c = None
|
545 |
if latent_file_4 is not None: # Check if a latent file is provided
|
546 |
sd_image_d = Image.open(latent_file_4.name).convert('RGB')
|
547 |
-
sd_image_d.resize((height,width), Image.LANCZOS)
|
|
|
548 |
#caption.append(captioner(sd_image_d))
|
549 |
caption.append(captioner2(sd_image_d))
|
550 |
#caption.append(captioner_3(sd_image_d))
|
@@ -553,7 +562,8 @@ def generate_60(
|
|
553 |
sd_image_d = None
|
554 |
if latent_file_5 is not None: # Check if a latent file is provided
|
555 |
sd_image_e = Image.open(latent_file_5.name).convert('RGB')
|
556 |
-
sd_image_e.resize((height,width), Image.LANCZOS)
|
|
|
557 |
#caption.append(captioner(sd_image_e))
|
558 |
caption.append(captioner2(sd_image_e))
|
559 |
#caption.append(captioner_3(sd_image_e))
|
@@ -564,6 +574,7 @@ def generate_60(
|
|
564 |
filename= f'rv_IP_{timestamp}.png'
|
565 |
print("-- using image file --")
|
566 |
|
|
|
567 |
caption = flatten_and_stringify(caption)
|
568 |
caption = " ".join(caption)
|
569 |
|
@@ -669,7 +680,8 @@ def generate_90(
|
|
669 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
670 |
if latent_file is not None: # Check if a latent file is provided
|
671 |
sd_image_a = Image.open(latent_file.name).convert('RGB')
|
672 |
-
sd_image_a.resize((
|
|
|
673 |
caption=[]
|
674 |
caption_2=[]
|
675 |
#caption.append(captioner(sd_image_a))
|
@@ -678,7 +690,8 @@ def generate_90(
|
|
678 |
caption_2.append(captioning(sd_image_a))
|
679 |
if latent_file_2 is not None: # Check if a latent file is provided
|
680 |
sd_image_b = Image.open(latent_file_2.name).convert('RGB')
|
681 |
-
sd_image_b.resize((height,width), Image.LANCZOS)
|
|
|
682 |
#caption.append(captioner(sd_image_b))
|
683 |
caption.append(captioner2(sd_image_b))
|
684 |
#caption.append(captioner_3(sd_image_b))
|
@@ -687,7 +700,8 @@ def generate_90(
|
|
687 |
sd_image_b = None
|
688 |
if latent_file_3 is not None: # Check if a latent file is provided
|
689 |
sd_image_c = Image.open(latent_file_3.name).convert('RGB')
|
690 |
-
sd_image_c.resize((height,width), Image.LANCZOS)
|
|
|
691 |
#caption.append(captioner(sd_image_c))
|
692 |
caption.append(captioner2(sd_image_c))
|
693 |
#caption.append(captioner_3(sd_image_c))
|
@@ -696,7 +710,8 @@ def generate_90(
|
|
696 |
sd_image_c = None
|
697 |
if latent_file_4 is not None: # Check if a latent file is provided
|
698 |
sd_image_d = Image.open(latent_file_4.name).convert('RGB')
|
699 |
-
sd_image_d.resize((height,width), Image.LANCZOS)
|
|
|
700 |
#caption.append(captioner(sd_image_d))
|
701 |
caption.append(captioner2(sd_image_d))
|
702 |
#caption.append(captioner_3(sd_image_d))
|
@@ -705,7 +720,8 @@ def generate_90(
|
|
705 |
sd_image_d = None
|
706 |
if latent_file_5 is not None: # Check if a latent file is provided
|
707 |
sd_image_e = Image.open(latent_file_5.name).convert('RGB')
|
708 |
-
sd_image_e.resize((height,width), Image.LANCZOS)
|
|
|
709 |
#caption.append(captioner(sd_image_e))
|
710 |
caption.append(captioner2(sd_image_e))
|
711 |
#caption.append(captioner_3(sd_image_e))
|
@@ -716,6 +732,7 @@ def generate_90(
|
|
716 |
filename= f'rv_IP_{timestamp}.png'
|
717 |
print("-- using image file --")
|
718 |
|
|
|
719 |
caption = flatten_and_stringify(caption)
|
720 |
caption = " ".join(caption)
|
721 |
|
|
|
365 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
366 |
if latent_file is not None: # Check if a latent file is provided
|
367 |
sd_image_a = Image.open(latent_file.name).convert('RGB')
|
368 |
+
sd_image_a.resize((224,224), Image.LANCZOS)
|
369 |
+
#sd_image_a.resize((height,width), Image.LANCZOS)
|
370 |
caption=[]
|
371 |
caption_2=[]
|
372 |
#caption.append(captioner(sd_image_a))
|
|
|
375 |
caption_2.append(captioning(sd_image_a))
|
376 |
if latent_file_2 is not None: # Check if a latent file is provided
|
377 |
sd_image_b = Image.open(latent_file_2.name).convert('RGB')
|
378 |
+
#sd_image_b.resize((height,width), Image.LANCZOS)
|
379 |
+
sd_image_b.resize((224,224), Image.LANCZOS)
|
380 |
#caption.append(captioner(sd_image_b))
|
381 |
caption.append(captioner2(sd_image_b))
|
382 |
#caption.append(captioner_3(sd_image_b))
|
|
|
385 |
sd_image_b = None
|
386 |
if latent_file_3 is not None: # Check if a latent file is provided
|
387 |
sd_image_c = Image.open(latent_file_3.name).convert('RGB')
|
388 |
+
#sd_image_c.resize((height,width), Image.LANCZOS)
|
389 |
+
sd_image_c.resize((224,224), Image.LANCZOS)
|
390 |
#caption.append(captioner(sd_image_c))
|
391 |
caption.append(captioner2(sd_image_c))
|
392 |
#caption.append(captioner_3(sd_image_c))
|
|
|
395 |
sd_image_c = None
|
396 |
if latent_file_4 is not None: # Check if a latent file is provided
|
397 |
sd_image_d = Image.open(latent_file_4.name).convert('RGB')
|
398 |
+
#sd_image_d.resize((height,width), Image.LANCZOS)
|
399 |
+
sd_image_d.resize((224,224), Image.LANCZOS)
|
400 |
#caption.append(captioner(sd_image_d))
|
401 |
caption.append(captioner2(sd_image_d))
|
402 |
#caption.append(captioner_3(sd_image_d))
|
|
|
405 |
sd_image_d = None
|
406 |
if latent_file_5 is not None: # Check if a latent file is provided
|
407 |
sd_image_e = Image.open(latent_file_5.name).convert('RGB')
|
408 |
+
#sd_image_e.resize((height,width), Image.LANCZOS)
|
409 |
+
sd_image_e.resize((224,224), Image.LANCZOS)
|
410 |
#caption.append(captioner(sd_image_e))
|
411 |
caption.append(captioner2(sd_image_e))
|
412 |
#caption.append(captioner_3(sd_image_e))
|
|
|
522 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
523 |
if latent_file is not None: # Check if a latent file is provided
|
524 |
sd_image_a = Image.open(latent_file.name).convert('RGB')
|
525 |
+
sd_image_a.resize((224,224), Image.LANCZOS)
|
526 |
+
#sd_image_a.resize((height,width), Image.LANCZOS)
|
527 |
caption=[]
|
528 |
caption_2=[]
|
529 |
#caption.append(captioner(sd_image_a))
|
|
|
532 |
caption_2.append(captioning(sd_image_a))
|
533 |
if latent_file_2 is not None: # Check if a latent file is provided
|
534 |
sd_image_b = Image.open(latent_file_2.name).convert('RGB')
|
535 |
+
#sd_image_b.resize((height,width), Image.LANCZOS)
|
536 |
+
sd_image_b.resize((224,224), Image.LANCZOS)
|
537 |
#caption.append(captioner(sd_image_b))
|
538 |
caption.append(captioner2(sd_image_b))
|
539 |
#caption.append(captioner_3(sd_image_b))
|
|
|
542 |
sd_image_b = None
|
543 |
if latent_file_3 is not None: # Check if a latent file is provided
|
544 |
sd_image_c = Image.open(latent_file_3.name).convert('RGB')
|
545 |
+
#sd_image_c.resize((height,width), Image.LANCZOS)
|
546 |
+
sd_image_c.resize((224,224), Image.LANCZOS)
|
547 |
#caption.append(captioner(sd_image_c))
|
548 |
caption.append(captioner2(sd_image_c))
|
549 |
#caption.append(captioner_3(sd_image_c))
|
|
|
552 |
sd_image_c = None
|
553 |
if latent_file_4 is not None: # Check if a latent file is provided
|
554 |
sd_image_d = Image.open(latent_file_4.name).convert('RGB')
|
555 |
+
#sd_image_d.resize((height,width), Image.LANCZOS)
|
556 |
+
sd_image_d.resize((224,224), Image.LANCZOS)
|
557 |
#caption.append(captioner(sd_image_d))
|
558 |
caption.append(captioner2(sd_image_d))
|
559 |
#caption.append(captioner_3(sd_image_d))
|
|
|
562 |
sd_image_d = None
|
563 |
if latent_file_5 is not None: # Check if a latent file is provided
|
564 |
sd_image_e = Image.open(latent_file_5.name).convert('RGB')
|
565 |
+
#sd_image_e.resize((height,width), Image.LANCZOS)
|
566 |
+
sd_image_e.resize((224,224), Image.LANCZOS)
|
567 |
#caption.append(captioner(sd_image_e))
|
568 |
caption.append(captioner2(sd_image_e))
|
569 |
#caption.append(captioner_3(sd_image_e))
|
|
|
574 |
filename= f'rv_IP_{timestamp}.png'
|
575 |
print("-- using image file --")
|
576 |
|
577 |
+
|
578 |
caption = flatten_and_stringify(caption)
|
579 |
caption = " ".join(caption)
|
580 |
|
|
|
680 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
681 |
if latent_file is not None: # Check if a latent file is provided
|
682 |
sd_image_a = Image.open(latent_file.name).convert('RGB')
|
683 |
+
sd_image_a.resize((224,224), Image.LANCZOS)
|
684 |
+
#sd_image_a.resize((height,width), Image.LANCZOS)
|
685 |
caption=[]
|
686 |
caption_2=[]
|
687 |
#caption.append(captioner(sd_image_a))
|
|
|
690 |
caption_2.append(captioning(sd_image_a))
|
691 |
if latent_file_2 is not None: # Check if a latent file is provided
|
692 |
sd_image_b = Image.open(latent_file_2.name).convert('RGB')
|
693 |
+
#sd_image_b.resize((height,width), Image.LANCZOS)
|
694 |
+
sd_image_b.resize((224,224), Image.LANCZOS)
|
695 |
#caption.append(captioner(sd_image_b))
|
696 |
caption.append(captioner2(sd_image_b))
|
697 |
#caption.append(captioner_3(sd_image_b))
|
|
|
700 |
sd_image_b = None
|
701 |
if latent_file_3 is not None: # Check if a latent file is provided
|
702 |
sd_image_c = Image.open(latent_file_3.name).convert('RGB')
|
703 |
+
#sd_image_c.resize((height,width), Image.LANCZOS)
|
704 |
+
sd_image_c.resize((224,224), Image.LANCZOS)
|
705 |
#caption.append(captioner(sd_image_c))
|
706 |
caption.append(captioner2(sd_image_c))
|
707 |
#caption.append(captioner_3(sd_image_c))
|
|
|
710 |
sd_image_c = None
|
711 |
if latent_file_4 is not None: # Check if a latent file is provided
|
712 |
sd_image_d = Image.open(latent_file_4.name).convert('RGB')
|
713 |
+
#sd_image_d.resize((height,width), Image.LANCZOS)
|
714 |
+
sd_image_d.resize((224,224), Image.LANCZOS)
|
715 |
#caption.append(captioner(sd_image_d))
|
716 |
caption.append(captioner2(sd_image_d))
|
717 |
#caption.append(captioner_3(sd_image_d))
|
|
|
720 |
sd_image_d = None
|
721 |
if latent_file_5 is not None: # Check if a latent file is provided
|
722 |
sd_image_e = Image.open(latent_file_5.name).convert('RGB')
|
723 |
+
#sd_image_e.resize((height,width), Image.LANCZOS)
|
724 |
+
sd_image_e.resize((224,224), Image.LANCZOS)
|
725 |
#caption.append(captioner(sd_image_e))
|
726 |
caption.append(captioner2(sd_image_e))
|
727 |
#caption.append(captioner_3(sd_image_e))
|
|
|
732 |
filename= f'rv_IP_{timestamp}.png'
|
733 |
print("-- using image file --")
|
734 |
|
735 |
+
|
736 |
caption = flatten_and_stringify(caption)
|
737 |
caption = " ".join(caption)
|
738 |
|