Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -485,26 +485,26 @@ def generate_30c(
|
|
485 |
"num_inference_steps": num_inference_steps,
|
486 |
"generator": generator,
|
487 |
"output_type": "pil",
|
488 |
-
"callback_on_step_end":
|
489 |
}
|
490 |
if use_resolution_binning:
|
491 |
options["use_resolution_binning"] = True
|
492 |
images = []
|
493 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
494 |
-
filename =
|
495 |
-
|
496 |
batch_options = options.copy()
|
497 |
rv_image = pipe(**batch_options).images[0]
|
498 |
sd_image_path = f"rv_C_{timestamp}.png"
|
499 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
500 |
-
|
501 |
torch.set_float32_matmul_precision("medium")
|
502 |
with torch.no_grad():
|
503 |
upscale = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
504 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
505 |
downscale_path = f"rv50_upscale_{timestamp}.png"
|
506 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
507 |
-
|
508 |
unique_name = str(uuid.uuid4()) + ".png"
|
509 |
os.symlink(sd_image_path, unique_name)
|
510 |
return [unique_name]
|
|
|
485 |
"num_inference_steps": num_inference_steps,
|
486 |
"generator": generator,
|
487 |
"output_type": "pil",
|
488 |
+
"callback_on_step_end": scheduler_swap_callback,
|
489 |
}
|
490 |
if use_resolution_binning:
|
491 |
options["use_resolution_binning"] = True
|
492 |
images = []
|
493 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
494 |
+
filename = uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
495 |
+
upload_to_ftp(filename)
|
496 |
batch_options = options.copy()
|
497 |
rv_image = pipe(**batch_options).images[0]
|
498 |
sd_image_path = f"rv_C_{timestamp}.png"
|
499 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
500 |
+
upload_to_ftp(sd_image_path)
|
501 |
torch.set_float32_matmul_precision("medium")
|
502 |
with torch.no_grad():
|
503 |
upscale = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
504 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
505 |
downscale_path = f"rv50_upscale_{timestamp}.png"
|
506 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
507 |
+
upload_to_ftp(downscale_path)
|
508 |
unique_name = str(uuid.uuid4()) + ".png"
|
509 |
os.symlink(sd_image_path, unique_name)
|
510 |
return [unique_name]
|