Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ from typing import Tuple
|
|
20 |
import paramiko
|
21 |
import datetime
|
22 |
# import cyper
|
23 |
-
from image_gen_aux import UpscaleWithModel
|
24 |
from huggingface_hub import hf_hub_download
|
25 |
|
26 |
torch.backends.cuda.matmul.allow_tf32 = False
|
@@ -85,7 +85,7 @@ neg_prompt_2 = " 'non-photorealistic':1.5, 'unrealistic skin','unattractive face
|
|
85 |
|
86 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
87 |
|
88 |
-
upscaler = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(device)
|
89 |
|
90 |
def load_and_prepare_model():
|
91 |
vaeX=AutoencoderKL.from_pretrained("ford442/stable-diffusion-3.5-large-fp32", safety_checker=None, use_safetensors=True, subfolder='vae', low_cpu_mem_usage=False, torch_dtype=torch.float32, token=True)
|
@@ -233,17 +233,18 @@ def generate(
|
|
233 |
#image.save(output_image_file,optimize=False,compress_level=0)
|
234 |
#upload_to_ftp(output_image_file)
|
235 |
#upscaler.to(torch.device('cuda'))
|
236 |
-
with torch.no_grad():
|
237 |
-
|
238 |
#timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
239 |
-
print('-- got upscaled image --')
|
240 |
-
downscale2 = upscale2.resize((upscale2.width // 4, upscale2.height // 4),Image.LANCZOS)
|
241 |
-
upscale_path = f"Large_Lora_L2_SR{seed}.png"
|
242 |
-
downscale2.save(upscale_path,optimize=False,compress_level=0)
|
243 |
-
|
|
|
244 |
#uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
245 |
unique_name = str(uuid.uuid4()) + ".png"
|
246 |
-
os.symlink(
|
247 |
return [unique_name], seed
|
248 |
else:
|
249 |
original_prompt_embeds_cpu = prompt_embeds.cpu()
|
|
|
20 |
import paramiko
|
21 |
import datetime
|
22 |
# import cyper
|
23 |
+
#from image_gen_aux import UpscaleWithModel
|
24 |
from huggingface_hub import hf_hub_download
|
25 |
|
26 |
torch.backends.cuda.matmul.allow_tf32 = False
|
|
|
85 |
|
86 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
87 |
|
88 |
+
#upscaler = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(device)
|
89 |
|
90 |
def load_and_prepare_model():
|
91 |
vaeX=AutoencoderKL.from_pretrained("ford442/stable-diffusion-3.5-large-fp32", safety_checker=None, use_safetensors=True, subfolder='vae', low_cpu_mem_usage=False, torch_dtype=torch.float32, token=True)
|
|
|
233 |
#image.save(output_image_file,optimize=False,compress_level=0)
|
234 |
#upload_to_ftp(output_image_file)
|
235 |
#upscaler.to(torch.device('cuda'))
|
236 |
+
#with torch.no_grad():
|
237 |
+
# upscale2 = upscaler(image, tiling=True, tile_width=256, tile_height=256)
|
238 |
#timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
239 |
+
#print('-- got upscaled image --')
|
240 |
+
#downscale2 = upscale2.resize((upscale2.width // 4, upscale2.height // 4),Image.LANCZOS)
|
241 |
+
#upscale_path = f"Large_Lora_L2_SR{seed}.png"
|
242 |
+
#downscale2.save(upscale_path,optimize=False,compress_level=0)
|
243 |
+
image.save(output_image_file,optimize=False,compress_level=0)
|
244 |
+
upload_to_ftp(output_image_file)
|
245 |
#uploadNote(prompt,num_inference_steps,guidance_scale,timestamp)
|
246 |
unique_name = str(uuid.uuid4()) + ".png"
|
247 |
+
os.symlink(output_image_file, unique_name)
|
248 |
return [unique_name], seed
|
249 |
else:
|
250 |
original_prompt_embeds_cpu = prompt_embeds.cpu()
|