feat : 代码梳理 移除所有敏感密钥 通过环境变量方式配置
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped

This commit is contained in:
zcr
2025-12-30 16:49:08 +08:00
parent 1be716e414
commit 18024a2d70
167 changed files with 5283 additions and 10464 deletions

View File

@@ -1,13 +1,10 @@
import json
import logging
import time
from fastapi import APIRouter, HTTPException
from app.schemas.prompt_generation import PromptGenerationImageModel, ImageRequest
from app.schemas.response_template import ResponseModel
from app.service.prompt_generation.chatgpt_for_translation import get_translation_from_llama3, \
get_prompt_from_image
from app.service.prompt_generation.chatgpt_for_translation import get_translation_from_llama3, get_prompt_from_image
router = APIRouter()
logger = logging.getLogger()
@@ -34,19 +31,19 @@ def prompt_generation(request_data: PromptGenerationImageModel):
raise HTTPException(status_code=404, detail=str(e))
return ResponseModel(data=data)
@router.post("/img2prompt")
def get_prompt_from_img(img: ImageRequest):
"""
自动识别图片并输出为prompt
:param img: 图片的minio地址
:return: 图片的文字描述
"""
text = ("Please describe the clothing in the image and provide a line art description of the outfit. "
"The description should allow for the reconstruction of the corresponding line art based on the details "
"given.")
logger.info(f"get_prompt_from_img request item is : @@@@@@:{img}")
description = get_prompt_from_image(img, text)
logger.info(f"生成的图片描述 response @@@@@@:{description}")
return description
# 停用
# @router.post("/img2prompt")
# def get_prompt_from_img(img: ImageRequest):
# """
# 自动识别图片并输出为prompt
#
# :param img: 图片的minio地址
# :return: 图片的文字描述
# """
# text = ("Please describe the clothing in the image and provide a line art description of the outfit. "
# "The description should allow for the reconstruction of the corresponding line art based on the details "
# "given.")
# logger.info(f"get_prompt_from_img request item is : @@@@@@:{img}")
# description = get_prompt_from_image(img, text)
# logger.info(f"生成的图片描述 response @@@@@@:{description}")
# return description