Spaces:
Sleeping
Sleeping
close image after processing
Browse files
app.py
CHANGED
@@ -102,8 +102,7 @@ def process_image(pil_image):
|
|
102 |
---------
|
103 |
image: path of the image to be processed
|
104 |
"""
|
105 |
-
inp = pil_image
|
106 |
-
inp.load()
|
107 |
img_exif = inp.getexif()
|
108 |
|
109 |
# Get image size
|
@@ -145,6 +144,9 @@ def process_image(pil_image):
|
|
145 |
bottom = (h + 224) // 2
|
146 |
image = inp.crop((left, top, right, bottom))
|
147 |
|
|
|
|
|
|
|
148 |
# Convert pil image to numpy array and scale color channels to [0, 1]
|
149 |
np_image = np.array(image) / 255
|
150 |
|
|
|
102 |
---------
|
103 |
image: path of the image to be processed
|
104 |
"""
|
105 |
+
inp = Image.open(pil_image)
|
|
|
106 |
img_exif = inp.getexif()
|
107 |
|
108 |
# Get image size
|
|
|
144 |
bottom = (h + 224) // 2
|
145 |
image = inp.crop((left, top, right, bottom))
|
146 |
|
147 |
+
# close image
|
148 |
+
inp.close()
|
149 |
+
|
150 |
# Convert pil image to numpy array and scale color channels to [0, 1]
|
151 |
np_image = np.array(image) / 255
|
152 |
|