Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -225,9 +225,9 @@ def save_image(img):
|
|
225 |
return unique_name
|
226 |
|
227 |
def uploadNote(prompt,num_inference_steps,guidance_scale,timestamp):
|
228 |
-
filename= f'
|
229 |
with open(filename, "w") as f:
|
230 |
-
f.write(f"Realvis 5.0 IP Adapter \n")
|
231 |
f.write(f"Date/time: {timestamp} \n")
|
232 |
f.write(f"Prompt: {prompt} \n")
|
233 |
f.write(f"Steps: {num_inference_steps} \n")
|
@@ -419,13 +419,14 @@ def generate_30(
|
|
419 |
else:
|
420 |
sd_image_e = None
|
421 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
422 |
-
filename= f'
|
423 |
print("-- using image file --")
|
|
|
424 |
captions = caption+caption_2
|
425 |
captions = flatten_and_stringify(captions)
|
426 |
captions = " ".join(captions)
|
427 |
print(captions)
|
428 |
-
print("-- generating further caption --")
|
429 |
global model5
|
430 |
global processor5
|
431 |
del captioner2
|
@@ -483,7 +484,7 @@ def generate_30(
|
|
483 |
with torch.no_grad():
|
484 |
upscale = upscaler(sd_image, tiling=True, tile_width=256, tile_height=256)
|
485 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
486 |
-
downscale_path = f"
|
487 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
488 |
upload_to_ftp(downscale_path)
|
489 |
image_paths = [save_image(downscale1)]
|
@@ -571,8 +572,9 @@ def generate_60(
|
|
571 |
else:
|
572 |
sd_image_e = None
|
573 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
574 |
-
filename= f'
|
575 |
print("-- using image file --")
|
|
|
576 |
captions = caption+caption_2
|
577 |
captions = flatten_and_stringify(captions)
|
578 |
captions = " ".join(captions)
|
@@ -634,7 +636,7 @@ def generate_60(
|
|
634 |
with torch.no_grad():
|
635 |
upscale = upscaler(sd_image, tiling=True, tile_width=256, tile_height=256)
|
636 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
637 |
-
downscale_path = f"
|
638 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
639 |
upload_to_ftp(downscale_path)
|
640 |
image_paths = [save_image(downscale1)]
|
@@ -723,8 +725,9 @@ def generate_90(
|
|
723 |
else:
|
724 |
sd_image_e = None
|
725 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
726 |
-
filename= f'
|
727 |
print("-- using image file --")
|
|
|
728 |
captions = caption+caption_2
|
729 |
captions = flatten_and_stringify(captions)
|
730 |
captions = " ".join(captions)
|
@@ -786,7 +789,7 @@ def generate_90(
|
|
786 |
with torch.no_grad():
|
787 |
upscale = upscaler(sd_image, tiling=True, tile_width=256, tile_height=256)
|
788 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
789 |
-
downscale_path = f"
|
790 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
791 |
upload_to_ftp(downscale_path)
|
792 |
image_paths = [save_image(downscale1)]
|
|
|
225 |
return unique_name
|
226 |
|
227 |
def uploadNote(prompt,num_inference_steps,guidance_scale,timestamp):
|
228 |
+
filename= f'IPa_{timestamp}.txt'
|
229 |
with open(filename, "w") as f:
|
230 |
+
f.write(f"Realvis 5.0 IP Adapter Test A\n")
|
231 |
f.write(f"Date/time: {timestamp} \n")
|
232 |
f.write(f"Prompt: {prompt} \n")
|
233 |
f.write(f"Steps: {num_inference_steps} \n")
|
|
|
419 |
else:
|
420 |
sd_image_e = None
|
421 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
422 |
+
filename= f'rv_IPa_{timestamp}.png'
|
423 |
print("-- using image file --")
|
424 |
+
caption.append(prompt)
|
425 |
captions = caption+caption_2
|
426 |
captions = flatten_and_stringify(captions)
|
427 |
captions = " ".join(captions)
|
428 |
print(captions)
|
429 |
+
print("-- not generating further caption --")
|
430 |
global model5
|
431 |
global processor5
|
432 |
del captioner2
|
|
|
484 |
with torch.no_grad():
|
485 |
upscale = upscaler(sd_image, tiling=True, tile_width=256, tile_height=256)
|
486 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
487 |
+
downscale_path = f"rvIPa_upscale_{timestamp}.png"
|
488 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
489 |
upload_to_ftp(downscale_path)
|
490 |
image_paths = [save_image(downscale1)]
|
|
|
572 |
else:
|
573 |
sd_image_e = None
|
574 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
575 |
+
filename= f'rv_IPa_{timestamp}.png'
|
576 |
print("-- using image file --")
|
577 |
+
caption.append(prompt)
|
578 |
captions = caption+caption_2
|
579 |
captions = flatten_and_stringify(captions)
|
580 |
captions = " ".join(captions)
|
|
|
636 |
with torch.no_grad():
|
637 |
upscale = upscaler(sd_image, tiling=True, tile_width=256, tile_height=256)
|
638 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
639 |
+
downscale_path = f"rvIPa_upscale_{timestamp}.png"
|
640 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
641 |
upload_to_ftp(downscale_path)
|
642 |
image_paths = [save_image(downscale1)]
|
|
|
725 |
else:
|
726 |
sd_image_e = None
|
727 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
728 |
+
filename= f'rv_IPa_{timestamp}.png'
|
729 |
print("-- using image file --")
|
730 |
+
caption.append(prompt)
|
731 |
captions = caption+caption_2
|
732 |
captions = flatten_and_stringify(captions)
|
733 |
captions = " ".join(captions)
|
|
|
789 |
with torch.no_grad():
|
790 |
upscale = upscaler(sd_image, tiling=True, tile_width=256, tile_height=256)
|
791 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
792 |
+
downscale_path = f"rvIPa_upscale_{timestamp}.png"
|
793 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
794 |
upload_to_ftp(downscale_path)
|
795 |
image_paths = [save_image(downscale1)]
|