Update app.py
Browse files
app.py
CHANGED
|
@@ -228,22 +228,23 @@ def infer(
|
|
| 228 |
width=width,
|
| 229 |
height=height,
|
| 230 |
# latents=None,
|
| 231 |
-
|
| 232 |
generator=generator,
|
| 233 |
max_sequence_length=512
|
| 234 |
-
).images
|
|
|
|
| 235 |
print('-- got image --')
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
sd35_path = f"sd35_{seed}.png"
|
| 241 |
-
|
| 242 |
upload_to_ftp(sd35_path)
|
| 243 |
-
|
| 244 |
-
#sd35_path = f"sd35_{seed}.png"
|
| 245 |
-
#sd_image.save(sd35_path,optimize=False,compress_level=0)
|
| 246 |
-
#upload_to_ftp(sd35_path)
|
| 247 |
# Convert the generated image to a tensor
|
| 248 |
#generated_image_tensor = torch.tensor([np.array(sd_image).transpose(2, 0, 1)]).to('cuda') / 255.0
|
| 249 |
# Encode the generated image into latents
|
|
|
|
| 228 |
width=width,
|
| 229 |
height=height,
|
| 230 |
# latents=None,
|
| 231 |
+
# output_type='latent',
|
| 232 |
generator=generator,
|
| 233 |
max_sequence_length=512
|
| 234 |
+
).images[0]
|
| 235 |
+
|
| 236 |
print('-- got image --')
|
| 237 |
+
#sd35_image = pipe.vae.decode(sd_image / 0.18215).sample
|
| 238 |
+
# sd35_image = sd35_image.cpu().permute(0, 2, 3, 1).float().detach().numpy()
|
| 239 |
+
# sd35_image = (sd35_image * 255).round().astype("uint8")
|
| 240 |
+
# image_pil = Image.fromarray(sd35_image[0])
|
| 241 |
+
# sd35_path = f"sd35_{seed}.png"
|
| 242 |
+
# image_pil.save(sd35_path,optimize=False,compress_level=0)
|
| 243 |
+
# upload_to_ftp(sd35_path)
|
| 244 |
+
|
| 245 |
sd35_path = f"sd35_{seed}.png"
|
| 246 |
+
sd_image.save(sd35_path,optimize=False,compress_level=0)
|
| 247 |
upload_to_ftp(sd35_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
# Convert the generated image to a tensor
|
| 249 |
#generated_image_tensor = torch.tensor([np.array(sd_image).transpose(2, 0, 1)]).to('cuda') / 255.0
|
| 250 |
# Encode the generated image into latents
|