Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ from io import BytesIO
|
|
13 |
import numpy as np
|
14 |
import torchvision.transforms as T
|
15 |
from PIL import Image,ImageOps,ImageFilter
|
|
|
16 |
|
17 |
|
18 |
|
@@ -60,8 +61,9 @@ if uploaded_file is not None:
|
|
60 |
img = PIL.Image.fromarray(x).convert('RGB')
|
61 |
size = a.size
|
62 |
im1 = img.resize(size)
|
63 |
-
|
64 |
-
|
|
|
65 |
im = im.convert('RGBA')
|
66 |
data = np.array(im) # "data" is a height x width x 4 numpy array
|
67 |
red, green, blue, alpha = data.T # Temporarily unpack the bands for readability'
|
|
|
13 |
import numpy as np
|
14 |
import torchvision.transforms as T
|
15 |
from PIL import Image,ImageOps,ImageFilter
|
16 |
+
from io import BytesIO
|
17 |
|
18 |
|
19 |
|
|
|
61 |
img = PIL.Image.fromarray(x).convert('RGB')
|
62 |
size = a.size
|
63 |
im1 = img.resize(size)
|
64 |
+
membuf = BytesIO()
|
65 |
+
im1.save(membuf, format="png")
|
66 |
+
im = Image.open(membuf)
|
67 |
im = im.convert('RGBA')
|
68 |
data = np.array(im) # "data" is a height x width x 4 numpy array
|
69 |
red, green, blue, alpha = data.T # Temporarily unpack the bands for readability'
|