Bentham commited on
Commit
adc28bf
·
verified ·
1 Parent(s): ed7f706

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -2
main.py CHANGED
@@ -790,18 +790,22 @@ def extract_text_with_image_markers(input_filename: str) -> Tuple[str, List[Tupl
790
  return text, images
791
 
792
 
793
- def extract_images_from_ppt(input_filename: str) -> List[bytes]:
794
  images = []
795
  if 'Presentation' not in globals():
796
  return images
797
  prs = Presentation(input_filename)
 
798
  for slide in prs.slides:
799
  for shape in slide.shapes:
800
  if shape.shape_type == MSO_SHAPE_TYPE.PICTURE:
801
  image = shape.image
802
  image_bytes = image.blob
803
- images.append(image_bytes)
 
804
  return images
 
 
805
  # MODIFICATIONS END
806
 
807
  @app.post("/convert_to_txt/")
 
790
  return text, images
791
 
792
 
793
+ def extract_images_from_ppt(input_filename: str) -> List[Tuple[int, bytes]]:
794
  images = []
795
  if 'Presentation' not in globals():
796
  return images
797
  prs = Presentation(input_filename)
798
+ img_num = 1 # Compteur pour numéroter les images
799
  for slide in prs.slides:
800
  for shape in slide.shapes:
801
  if shape.shape_type == MSO_SHAPE_TYPE.PICTURE:
802
  image = shape.image
803
  image_bytes = image.blob
804
+ images.append((img_num, image_bytes))
805
+ img_num += 1
806
  return images
807
+
808
+
809
  # MODIFICATIONS END
810
 
811
  @app.post("/convert_to_txt/")