Removed img_buf.close operation to ensure image is usable after loading from buffer
Browse files
app.py
CHANGED
|
@@ -305,8 +305,6 @@ def count(image, text, prompts, state, device):
|
|
| 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,8 +391,6 @@ def count_main(image, text, prompts, device):
|
|
| 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"
|
|
|
|
| 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 |
|
| 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"
|