Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -266,7 +266,7 @@ def upload_to_ftp(filename):
|
|
266 |
print(f"FTP upload error: {e}")
|
267 |
|
268 |
def uploadNote(prompt,num_inference_steps,guidance_scale,timestamp):
|
269 |
-
filename= f'
|
270 |
with open(filename, "w") as f:
|
271 |
f.write(f"Realvis 5.0 (Tester D) \n")
|
272 |
f.write(f"Date/time: {timestamp} \n")
|
@@ -370,7 +370,14 @@ def generate_60(
|
|
370 |
rv_image = pipe(**batch_options).images[0]
|
371 |
sd_image_path = f"rv_D_{timestamp}.png"
|
372 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
373 |
-
upload_to_ftp(sd_image_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
unique_name = str(uuid.uuid4()) + ".png"
|
375 |
os.symlink(sd_image_path, unique_name)
|
376 |
return [unique_name]
|
@@ -411,7 +418,14 @@ def generate_90(
|
|
411 |
rv_image = pipe(**batch_options).images[0]
|
412 |
sd_image_path = f"rv_D_{timestamp}.png"
|
413 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
414 |
-
upload_to_ftp(sd_image_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
unique_name = str(uuid.uuid4()) + ".png"
|
416 |
os.symlink(sd_image_path, unique_name)
|
417 |
return [unique_name]
|
|
|
266 |
print(f"FTP upload error: {e}")
|
267 |
|
268 |
def uploadNote(prompt,num_inference_steps,guidance_scale,timestamp):
|
269 |
+
filename= f'rv_D_{timestamp}.txt'
|
270 |
with open(filename, "w") as f:
|
271 |
f.write(f"Realvis 5.0 (Tester D) \n")
|
272 |
f.write(f"Date/time: {timestamp} \n")
|
|
|
370 |
rv_image = pipe(**batch_options).images[0]
|
371 |
sd_image_path = f"rv_D_{timestamp}.png"
|
372 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
373 |
+
pyx.upload_to_ftp(sd_image_path)
|
374 |
+
torch.set_float32_matmul_precision("medium")
|
375 |
+
with torch.no_grad():
|
376 |
+
upscale = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
377 |
+
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
378 |
+
downscale_path = f"rv_D_upscale_{timestamp}.png"
|
379 |
+
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
380 |
+
pyx.upload_to_ftp(downscale_path)
|
381 |
unique_name = str(uuid.uuid4()) + ".png"
|
382 |
os.symlink(sd_image_path, unique_name)
|
383 |
return [unique_name]
|
|
|
418 |
rv_image = pipe(**batch_options).images[0]
|
419 |
sd_image_path = f"rv_D_{timestamp}.png"
|
420 |
rv_image.save(sd_image_path,optimize=False,compress_level=0)
|
421 |
+
pyx.upload_to_ftp(sd_image_path)
|
422 |
+
torch.set_float32_matmul_precision("medium")
|
423 |
+
with torch.no_grad():
|
424 |
+
upscale = upscaler(rv_image, tiling=True, tile_width=256, tile_height=256)
|
425 |
+
downscale1 = upscale.resize((upscale.width // 4, upscale.height // 4), Image.LANCZOS)
|
426 |
+
downscale_path = f"rv_D_upscale_{timestamp}.png"
|
427 |
+
downscale1.save(downscale_path,optimize=False,compress_level=0)
|
428 |
+
pyx.upload_to_ftp(downscale_path)
|
429 |
unique_name = str(uuid.uuid4()) + ".png"
|
430 |
os.symlink(sd_image_path, unique_name)
|
431 |
return [unique_name]
|