Phizzly commited on
Commit
dd970d6
·
1 Parent(s): 4b15bf8

close image after processing

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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