user-agent
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -429,16 +429,9 @@ def get_cropped_images(images,category):
|
|
429 |
continue
|
430 |
|
431 |
cropped_list.append(image)
|
432 |
-
|
433 |
-
for
|
434 |
-
|
435 |
-
with io.BytesIO() as buffer:
|
436 |
-
# Save the image to the BytesIO object
|
437 |
-
crop.save(buffer, format="JPG")
|
438 |
-
# Encode the image data to base64
|
439 |
-
base64_image = base64.b64encode(buffer.getvalue()).decode("utf-8")
|
440 |
-
# Append the base64 encoded image to the list
|
441 |
-
base64_images.append(base64_image)
|
442 |
|
443 |
return base64_images
|
444 |
|
|
|
429 |
continue
|
430 |
|
431 |
cropped_list.append(image)
|
432 |
+
|
433 |
+
base64_images = [base64.b64encode(BytesIO(image.save(format='JPG')).getvalue()).decode('utf-8') for image in cropped_list]
|
434 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
|
436 |
return base64_images
|
437 |
|