user-agent
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -429,8 +429,18 @@ def get_cropped_images(images,category):
|
|
429 |
continue
|
430 |
|
431 |
cropped_list.append(image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
|
433 |
-
return
|
434 |
|
435 |
|
436 |
|
|
|
429 |
continue
|
430 |
|
431 |
cropped_list.append(image)
|
432 |
+
base64_images = []
|
433 |
+
for crop in cropped_list:
|
434 |
+
# Create a BytesIO object to temporarily hold the image data
|
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 |
|
445 |
|
446 |
|