Update app.py
Browse files
app.py
CHANGED
@@ -69,7 +69,7 @@ def generate_image(seed_image):
|
|
69 |
|
70 |
generated_image = diffusion.sample(model, y=input_img_pil, labels=None, n=1)
|
71 |
|
72 |
-
inp_img = (
|
73 |
inp_img = (inp_img * 255).type(torch.uint8) # to bring in valid pixel range
|
74 |
inp_img = np.squeeze(inp_img.cpu().numpy())
|
75 |
inp = Image.fromarray(inp_img) # Create a PIL Image from array
|
|
|
69 |
|
70 |
generated_image = diffusion.sample(model, y=input_img_pil, labels=None, n=1)
|
71 |
|
72 |
+
inp_img = (input_img_pil.clamp(-1, 1) + 1) / 2 # to be in [-1, 1], the plus 1 and the division by 2 is to bring back values to [0, 1]
|
73 |
inp_img = (inp_img * 255).type(torch.uint8) # to bring in valid pixel range
|
74 |
inp_img = np.squeeze(inp_img.cpu().numpy())
|
75 |
inp = Image.fromarray(inp_img) # Create a PIL Image from array
|