Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -287,7 +287,13 @@ def generate_30(
|
|
287 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
288 |
if latent_file.any(): # Check if a latent file is provided
|
289 |
#sd_image_a = torch.load(latent_file.name) # Load the latent
|
290 |
-
sd_image_a = latent_file #Image.open(latent_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
292 |
filename= f'rv_IP_{timestamp}.txt'
|
293 |
print("-- using image file --")
|
@@ -341,7 +347,13 @@ def generate_60(
|
|
341 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
342 |
if latent_file.any(): # Check if a latent file is provided
|
343 |
#sd_image_a = torch.load(latent_file.name) # Load the latent
|
344 |
-
sd_image_a = latent_file #Image.open(latent_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
346 |
filename= f'rv_IP_{timestamp}.txt'
|
347 |
print("-- using image file --")
|
@@ -395,7 +407,13 @@ def generate_90(
|
|
395 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
396 |
if latent_file.any(): # Check if a latent file is provided
|
397 |
#sd_image_a = torch.load(latent_file.name) # Load the latent
|
398 |
-
sd_image_a = latent_file #Image.open(latent_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
400 |
filename= f'rv_IP_{timestamp}.txt'
|
401 |
print("-- using image file --")
|
|
|
287 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
288 |
if latent_file.any(): # Check if a latent file is provided
|
289 |
#sd_image_a = torch.load(latent_file.name) # Load the latent
|
290 |
+
#sd_image_a = latent_file #Image.open(latent_file)
|
291 |
+
if not isinstance(latent_file, Image.Image):
|
292 |
+
image = Image.fromarray(latent_file)
|
293 |
+
image = image.resize((width, height)) # Example resize, adjust as needed
|
294 |
+
image = image.convert("RGB") # Ensure it's a 3-channel image
|
295 |
+
image = np.array(image)
|
296 |
+
sd_image_a = torch.from_numpy(image).permute(2, 0, 1) / 127.5 - 1.0 # Normalize
|
297 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
298 |
filename= f'rv_IP_{timestamp}.txt'
|
299 |
print("-- using image file --")
|
|
|
347 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
348 |
if latent_file.any(): # Check if a latent file is provided
|
349 |
#sd_image_a = torch.load(latent_file.name) # Load the latent
|
350 |
+
#sd_image_a = latent_file #Image.open(latent_file)
|
351 |
+
if not isinstance(latent_file, Image.Image):
|
352 |
+
image = Image.fromarray(latent_file)
|
353 |
+
image = image.resize((width, height)) # Example resize, adjust as needed
|
354 |
+
image = image.convert("RGB") # Ensure it's a 3-channel image
|
355 |
+
image = np.array(image)
|
356 |
+
sd_image_a = torch.from_numpy(image).permute(2, 0, 1) / 127.5 - 1.0 # Normalize
|
357 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
358 |
filename= f'rv_IP_{timestamp}.txt'
|
359 |
print("-- using image file --")
|
|
|
407 |
generator = torch.Generator(device='cuda').manual_seed(seed)
|
408 |
if latent_file.any(): # Check if a latent file is provided
|
409 |
#sd_image_a = torch.load(latent_file.name) # Load the latent
|
410 |
+
#sd_image_a = latent_file #Image.open(latent_file)
|
411 |
+
if not isinstance(latent_file, Image.Image):
|
412 |
+
image = Image.fromarray(latent_file)
|
413 |
+
image = image.resize((width, height)) # Example resize, adjust as needed
|
414 |
+
image = image.convert("RGB") # Ensure it's a 3-channel image
|
415 |
+
image = np.array(image)
|
416 |
+
sd_image_a = torch.from_numpy(image).permute(2, 0, 1) / 127.5 - 1.0 # Normalize
|
417 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
418 |
filename= f'rv_IP_{timestamp}.txt'
|
419 |
print("-- using image file --")
|