feat : 代码梳理 移除所有敏感密钥 通过环境变量方式配置
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
This commit is contained in:
@@ -6,12 +6,14 @@ import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
import tritonclient.http as httpclient
|
||||
|
||||
from minio import Minio
|
||||
from app.core.config import settings
|
||||
from app.core.config import DESIGN_MODEL_URL
|
||||
from app.schemas.image2sketch import Image2SketchModel
|
||||
from app.service.utils.oss_client import oss_get_image, oss_upload_image
|
||||
from app.service.utils.new_oss_client import oss_get_image, oss_upload_image
|
||||
|
||||
logger = logging.getLogger()
|
||||
minio_client = Minio(settings.MINIO_URL, access_key=settings.MINIO_ACCESS, secret_key=settings.MINIO_SECRET, secure=settings.MINIO_SECURE)
|
||||
|
||||
|
||||
class LineArtService:
|
||||
@@ -58,7 +60,7 @@ class LineArtService:
|
||||
def put_image(self, image):
|
||||
try:
|
||||
image_bytes = cv2.imencode('.jpg', image)[1].tobytes()
|
||||
oss_upload_image(bucket=self.sketch_bucket, object_name=f"{self.sketch_name}.jpg", image_bytes=image_bytes)
|
||||
oss_upload_image(oss_client=minio_client, bucket=self.sketch_bucket, object_name=f"{self.sketch_name}.jpg", image_bytes=image_bytes)
|
||||
return f"{self.sketch_bucket}/{self.sketch_name}.jpg"
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
|
||||
Reference in New Issue
Block a user