nikigoli commited on
Commit
e63875d
·
verified ·
1 Parent(s): fff3ddf

Closed the img buffer after use

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -305,6 +305,8 @@ def count(image, text, prompts, state, device):
305
 
306
  output_img = Image.open(img_buf)
307
 
 
 
308
  if AppSteps.TEXT_AND_EXEMPLARS not in state:
309
  exemplar_image = ImagePrompter(type='pil', label='Visual Exemplar Image', value=prompts, interactive=True, visible=True)
310
  new_submit_btn = gr.Button("Count", variant="primary", interactive=False)
@@ -391,6 +393,8 @@ def count_main(image, text, prompts, device):
391
 
392
  output_img = Image.open(img_buf)
393
 
 
 
394
  out_label = "Detected instances predicted with"
395
  if len(text.strip()) > 0:
396
  out_label += " text"
 
305
 
306
  output_img = Image.open(img_buf)
307
 
308
+ img_buf.close()
309
+
310
  if AppSteps.TEXT_AND_EXEMPLARS not in state:
311
  exemplar_image = ImagePrompter(type='pil', label='Visual Exemplar Image', value=prompts, interactive=True, visible=True)
312
  new_submit_btn = gr.Button("Count", variant="primary", interactive=False)
 
393
 
394
  output_img = Image.open(img_buf)
395
 
396
+ img_buf.close()
397
+
398
  out_label = "Detected instances predicted with"
399
  if len(text.strip()) > 0:
400
  out_label += " text"