Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -114,7 +114,7 @@ def scheduler_swap_callback(pipeline, step_index, timestep, callback_kwargs):
|
|
114 |
# pipe.vae = vae_a
|
115 |
# pipe.unet = unet_a
|
116 |
torch.backends.cudnn.deterministic = False
|
117 |
-
pipe.unet.set_default_attn_processor()
|
118 |
print("-- swapping scheduler --")
|
119 |
# pipeline.scheduler = heun_scheduler
|
120 |
#pipe.scheduler.set_timesteps(num_inference_steps*.70)
|
@@ -248,7 +248,7 @@ def upload_to_ftp(filename):
|
|
248 |
def uploadNote(prompt,num_inference_steps,guidance_scale,timestamp):
|
249 |
filename= f'rv_C_{timestamp}.txt'
|
250 |
with open(filename, "w") as f:
|
251 |
-
f.write(f"Realvis 5.0 (Tester
|
252 |
f.write(f"Date/time: {timestamp} \n")
|
253 |
f.write(f"Prompt: {prompt} \n")
|
254 |
f.write(f"Steps: {num_inference_steps} \n")
|
@@ -300,14 +300,14 @@ def generate_30(
|
|
300 |
#uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
301 |
batch_options = options.copy()
|
302 |
rv_image = pipe(**batch_options).images[0]
|
303 |
-
sd_image_path = f"
|
304 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
305 |
pyx.upload_to_ftp(sd_image_path)
|
306 |
torch.set_float32_matmul_precision("medium")
|
307 |
with torch.no_grad():
|
308 |
upscale = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
309 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
310 |
-
downscale_path = f"
|
311 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
312 |
pyx.upload_to_ftp(downscale_path)
|
313 |
unique_name = str(uuid.uuid4()) + ".png"
|
@@ -348,7 +348,7 @@ def generate_60(
|
|
348 |
uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
349 |
batch_options = options.copy()
|
350 |
rv_image = pipe(**batch_options).images[0]
|
351 |
-
sd_image_path = f"
|
352 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
353 |
upload_to_ftp(sd_image_path)
|
354 |
unique_name = str(uuid.uuid4()) + ".png"
|
@@ -389,7 +389,7 @@ def generate_90(
|
|
389 |
uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
390 |
batch_options = options.copy()
|
391 |
rv_image = pipe(**batch_options).images[0]
|
392 |
-
sd_image_path = f"
|
393 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
394 |
upload_to_ftp(sd_image_path)
|
395 |
unique_name = str(uuid.uuid4()) + ".png"
|
|
|
114 |
# pipe.vae = vae_a
|
115 |
# pipe.unet = unet_a
|
116 |
torch.backends.cudnn.deterministic = False
|
117 |
+
#pipe.unet.set_default_attn_processor()
|
118 |
print("-- swapping scheduler --")
|
119 |
# pipeline.scheduler = heun_scheduler
|
120 |
#pipe.scheduler.set_timesteps(num_inference_steps*.70)
|
|
|
248 |
def uploadNote(prompt,num_inference_steps,guidance_scale,timestamp):
|
249 |
filename= f'rv_C_{timestamp}.txt'
|
250 |
with open(filename, "w") as f:
|
251 |
+
f.write(f"Realvis 5.0 (Tester D) \n")
|
252 |
f.write(f"Date/time: {timestamp} \n")
|
253 |
f.write(f"Prompt: {prompt} \n")
|
254 |
f.write(f"Steps: {num_inference_steps} \n")
|
|
|
300 |
#uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
301 |
batch_options = options.copy()
|
302 |
rv_image = pipe(**batch_options).images[0]
|
303 |
+
sd_image_path = f"rv_D_{timestamp}.png"
|
304 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
305 |
pyx.upload_to_ftp(sd_image_path)
|
306 |
torch.set_float32_matmul_precision("medium")
|
307 |
with torch.no_grad():
|
308 |
upscale = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
309 |
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
310 |
+
downscale_path = f"rv_D_upscale_{timestamp}.png"
|
311 |
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
312 |
pyx.upload_to_ftp(downscale_path)
|
313 |
unique_name = str(uuid.uuid4()) + ".png"
|
|
|
348 |
uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
349 |
batch_options = options.copy()
|
350 |
rv_image = pipe(**batch_options).images[0]
|
351 |
+
sd_image_path = f"rv_D_{timestamp}.png"
|
352 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
353 |
upload_to_ftp(sd_image_path)
|
354 |
unique_name = str(uuid.uuid4()) + ".png"
|
|
|
389 |
uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
390 |
batch_options = options.copy()
|
391 |
rv_image = pipe(**batch_options).images[0]
|
392 |
+
sd_image_path = f"rv_D_{timestamp}.png"
|
393 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
394 |
upload_to_ftp(sd_image_path)
|
395 |
unique_name = str(uuid.uuid4()) + ".png"
|