feat generate 升级 attribute retrieve 迁移
This commit is contained in:
@@ -3,11 +3,8 @@ import mmcv
|
||||
import numpy as np
|
||||
import torch
|
||||
from PIL import Image
|
||||
|
||||
import tritonclient.http as httpclient
|
||||
|
||||
import torch.nn.functional as F
|
||||
|
||||
from app.core.config import *
|
||||
|
||||
|
||||
|
||||
@@ -9,25 +9,29 @@
|
||||
"""
|
||||
import io
|
||||
import logging
|
||||
|
||||
from PIL import Image
|
||||
from minio import Minio
|
||||
|
||||
from app.core.config import *
|
||||
|
||||
minio_client = Minio(
|
||||
f"{MINIO_IP}:{MINIO_PORT}",
|
||||
access_key=MINIO_ACCESS,
|
||||
secret_key=MINIO_SECRET,
|
||||
secure=MINIO_SECURE)
|
||||
minio_client = Minio(MINIO_URL, access_key=MINIO_ACCESS, secret_key=MINIO_SECRET, secure=MINIO_SECURE)
|
||||
|
||||
|
||||
def upload_png_sd(image, user_id, category, object_name):
|
||||
try:
|
||||
image_data = io.BytesIO()
|
||||
image.save(image_data, format='PNG')
|
||||
image_data.seek(0)
|
||||
image_bytes = image_data.read()
|
||||
image_url = f"aida-users/{minio_client.put_object(f'{GI_MINIO_BUCKET}', f'{user_id}/{category}/{object_name}', io.BytesIO(image_bytes), len(image_bytes), content_type='image/png').object_name}"
|
||||
|
||||
image_file = io.BytesIO()
|
||||
image = Image.fromarray(image)
|
||||
image.save(image_file, format='JPEG')
|
||||
image_file.seek(0)
|
||||
minio_req = minio_client.put_object(
|
||||
GI_MINIO_BUCKET,
|
||||
f'{user_id}/{category}/{object_name}',
|
||||
image_file,
|
||||
len(image_file.getvalue()),
|
||||
content_type='image/jpeg'
|
||||
)
|
||||
image_url = f"aida-users/{minio_req.object_name}"
|
||||
return image_url
|
||||
except Exception as e:
|
||||
logging.warning(f"upload_png_mask runtime exception : {e}")
|
||||
|
||||
Reference in New Issue
Block a user