Ahsen Khaliq
commited on
Commit
·
1d0c905
1
Parent(s):
442b118
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,10 +28,6 @@ def face2paint(
|
|
| 28 |
side_by_side: bool = False,
|
| 29 |
) -> Image.Image:
|
| 30 |
|
| 31 |
-
w, h = img.size
|
| 32 |
-
s = min(w, h)
|
| 33 |
-
img = img.crop(((w - s) // 2, (h - s) // 2, (w + s) // 2, (h + s) // 2))
|
| 34 |
-
img = img.resize((size, size), Image.LANCZOS)
|
| 35 |
|
| 36 |
input = to_tensor(img).unsqueeze(0) * 2 - 1
|
| 37 |
output = model(input.to(device)).cpu()[0]
|
|
|
|
| 28 |
side_by_side: bool = False,
|
| 29 |
) -> Image.Image:
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
input = to_tensor(img).unsqueeze(0) * 2 - 1
|
| 33 |
output = model(input.to(device)).cpu()[0]
|