stzhao commited on
Commit
db3bd9e
·
verified ·
1 Parent(s): bf85807

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -59,9 +59,12 @@ def render_annotations(annotations, image_dir):
59
  draw_annotation(canvas, annotation['bbox'], annotation['category'], annotation['source_code'])
60
 
61
  # Save the annotated image to a buffer
 
62
  surface = canvas.getSurface()
63
- image_buffer = surface.makeImageSnapshot().encode(skia.kPNG_Codec)
64
- annotated_images.append((image_buffer, f"Page {page_index}"))
 
 
65
 
66
  return annotated_images
67
 
 
59
  draw_annotation(canvas, annotation['bbox'], annotation['category'], annotation['source_code'])
60
 
61
  # Save the annotated image to a buffer
62
+ output_path = f"annotated_page_{page_index:04d}.png"
63
  surface = canvas.getSurface()
64
+ # image_buffer = surface.makeImageSnapshot().encode(skia.kPNG_Codec)
65
+ # annotated_images.append((image_buffer, f"Page {page_index}"))
66
+ surface.makeImageSnapshot().save(output_path, skia.kPNG_Codec)
67
+ annotated_images.append(output_path)
68
 
69
  return annotated_images
70