feat generate sketch 新增 服装类别识别
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
import io
|
||||
import logging
|
||||
|
||||
import cv2
|
||||
from PIL import Image
|
||||
from minio import Minio
|
||||
|
||||
@@ -20,15 +21,12 @@ minio_client = Minio(MINIO_URL, access_key=MINIO_ACCESS, secret_key=MINIO_SECRET
|
||||
|
||||
def upload_png_sd(image, user_id, category, object_name):
|
||||
try:
|
||||
image_file = io.BytesIO()
|
||||
image = Image.fromarray(image)
|
||||
image.save(image_file, format='JPEG')
|
||||
image_file.seek(0)
|
||||
_, img_byte_array = cv2.imencode('.jpg', image)
|
||||
minio_req = minio_client.put_object(
|
||||
GI_MINIO_BUCKET,
|
||||
f'{user_id}/{category}/{object_name}',
|
||||
image_file,
|
||||
len(image_file.getvalue()),
|
||||
io.BytesIO(img_byte_array),
|
||||
len(img_byte_array),
|
||||
content_type='image/jpeg'
|
||||
)
|
||||
image_url = f"aida-users/{minio_req.object_name}"
|
||||
|
||||
Reference in New Issue
Block a user