Julián Tachella commited on
Commit ·
225e8dd
1
Parent(s): 26a9ba5
test
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ def pil_to_torch(image):
|
|
| 15 |
def torch_to_pil(image):
|
| 16 |
image = image.squeeze(0).cpu().detach().numpy()
|
| 17 |
image = image.transpose((1, 2, 0))
|
| 18 |
-
image = (image * 255).astype(np.uint8)
|
| 19 |
image = PIL.Image.fromarray(image)
|
| 20 |
return image
|
| 21 |
|
|
|
|
| 15 |
def torch_to_pil(image):
|
| 16 |
image = image.squeeze(0).cpu().detach().numpy()
|
| 17 |
image = image.transpose((1, 2, 0))
|
| 18 |
+
image = (torch.clip(image, 0, 1) * 255).astype(np.uint8)
|
| 19 |
image = PIL.Image.fromarray(image)
|
| 20 |
return image
|
| 21 |
|