Skip to content
Snippets Groups Projects

Use multithreading to download images at the end, remove cache as we now...

Merged Yoann Schneider requested to merge support-offset-pages into main
1 file
+ 5
1
Compare changes
  • Side-by-side
  • Inline
@@ -5,7 +5,7 @@ from io import BytesIO
from typing import List
import requests
from PIL import Image
from PIL import Image, ImageOps
from tenacity import (
retry,
retry_if_exception_type,
@@ -56,6 +56,10 @@ def download_image(url):
# Preprocess the image and prepare it for classification
image = Image.open(BytesIO(resp.content))
# Do not rotate JPEG images (see https://github.com/python-pillow/Pillow/issues/4703)
image = ImageOps.exif_transpose(image)
logger.debug(
"Downloaded image {} - size={}x{}".format(url, image.size[0], image.size[1])
)
Loading