Update app.py
Browse files
app.py
CHANGED
|
@@ -195,9 +195,9 @@ def infer(
|
|
| 195 |
width=width,
|
| 196 |
height=height,
|
| 197 |
latents=sd_image_a,
|
| 198 |
-
|
| 199 |
generator=generator
|
| 200 |
-
).images
|
| 201 |
else:
|
| 202 |
print('-- generating image --')
|
| 203 |
#with torch.no_grad():
|
|
@@ -211,17 +211,17 @@ def infer(
|
|
| 211 |
width=width,
|
| 212 |
height=height,
|
| 213 |
# latents=None,
|
| 214 |
-
|
| 215 |
generator=generator,
|
| 216 |
max_sequence_length=512
|
| 217 |
-
).images
|
| 218 |
print('-- got image --')
|
| 219 |
-
sd35_image = pipe.vae.decode(sd_image / 0.18215).sample
|
| 220 |
-
sd35_image = sdxl_image.cpu().permute(0, 2, 3, 1).float().detach().numpy()
|
| 221 |
-
sd35_image = (sdxl_image * 255).round().astype("uint8")
|
| 222 |
-
image_pil = Image.fromarray(sd35_image[0])
|
| 223 |
-
sd35_path = f"
|
| 224 |
-
|
| 225 |
upload_to_ftp(sd35_path)
|
| 226 |
|
| 227 |
# Convert the generated image to a tensor
|
|
|
|
| 195 |
width=width,
|
| 196 |
height=height,
|
| 197 |
latents=sd_image_a,
|
| 198 |
+
# output='latent',
|
| 199 |
generator=generator
|
| 200 |
+
).images[0]
|
| 201 |
else:
|
| 202 |
print('-- generating image --')
|
| 203 |
#with torch.no_grad():
|
|
|
|
| 211 |
width=width,
|
| 212 |
height=height,
|
| 213 |
# latents=None,
|
| 214 |
+
# output='latent',
|
| 215 |
generator=generator,
|
| 216 |
max_sequence_length=512
|
| 217 |
+
).images[0]
|
| 218 |
print('-- got image --')
|
| 219 |
+
#sd35_image = pipe.vae.decode(sd_image / 0.18215).sample
|
| 220 |
+
#sd35_image = sdxl_image.cpu().permute(0, 2, 3, 1).float().detach().numpy()
|
| 221 |
+
#sd35_image = (sdxl_image * 255).round().astype("uint8")
|
| 222 |
+
#image_pil = Image.fromarray(sd35_image[0])
|
| 223 |
+
sd35_path = f"sd35_{seed}.png"
|
| 224 |
+
sd_image.save(sd35_path,optimize=False,compress_level=0)
|
| 225 |
upload_to_ftp(sd35_path)
|
| 226 |
|
| 227 |
# Convert the generated image to a tensor
|