mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Refactor Dockerfile and backend API for improved image processing and dependency management
This commit is contained in:
parent
f571237eb7
commit
9b3e7a69d2
4 changed files with 9 additions and 22 deletions
|
|
@ -21,7 +21,7 @@ from urllib.parse import quote_plus
|
|||
from hashlib import sha256
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
from PIL import Image, UnidentifiedImageError
|
||||
has_pillow = True
|
||||
except ImportError:
|
||||
has_pillow = False
|
||||
|
|
@ -452,7 +452,10 @@ class Backend_Api(Api):
|
|||
image_size = {"width": width, "height": height}
|
||||
thumbnail_dir = os.path.join(bucket_dir, "thumbnail")
|
||||
os.makedirs(thumbnail_dir, exist_ok=True)
|
||||
process_image(image, save=os.path.join(thumbnail_dir, filename))
|
||||
width, height = process_image(image, save=os.path.join(thumbnail_dir, filename))
|
||||
image_size = {"width": width, "height": height}
|
||||
except UnidentifiedImageError:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
if result:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue