feat 新增 process lookbooks 接口
fix
This commit is contained in:
@@ -16,11 +16,10 @@
|
||||
|
||||
1. 安装依赖
|
||||
|
||||
$ conda create -n trinity_client_mixi python=3.9 -y
|
||||
$ conda create -n trinity_client_mixi python=3.12 -y
|
||||
$ conda activate trinity_client_mixi
|
||||
$ pip install -r requirements.txt
|
||||
$ conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia -y
|
||||
$ pip install mmcv==1.4.2 -f https://download.openmmlab.com/mmcv/dist/cu117/torch1.13/index.html
|
||||
|
||||
|
||||
2. 启动服务器
|
||||
|
||||
@@ -11,7 +11,7 @@ logger = logging.getLogger()
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post("")
|
||||
@router.post("/attribute")
|
||||
def attribute(request_data: AttributeModel):
|
||||
logger.info(f"attribute requests is @@@@@@@@@@@:{request_data}")
|
||||
service = AttributeRecognition()
|
||||
|
||||
@@ -16,7 +16,7 @@ logger = logging.getLogger()
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post("outfit_matcher")
|
||||
@router.post("/outfit_matcher")
|
||||
def outfit_matcher(request_item: OutfitMatcher):
|
||||
start_time = time.time()
|
||||
request_item = dict(request_item)
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from typing import List
|
||||
|
||||
import aiofiles
|
||||
import tqdm
|
||||
from fastapi import UploadFile, File, APIRouter, BackgroundTasks, Form
|
||||
from app.service.lookbooks.service import create_image_batch_requests, process_lookbook_task # 引入服务逻辑
|
||||
|
||||
from app.service.lookbooks.service import process_lookbook_task # 引入服务逻辑
|
||||
|
||||
logger = logging.getLogger()
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post("/process-lookbooks/")
|
||||
@router.post("/process-lookbooks")
|
||||
async def process_lookbooks(
|
||||
background_tasks: BackgroundTasks,
|
||||
files: List[UploadFile] = File(...),
|
||||
|
||||
@@ -5,7 +5,7 @@ from app.api import api_test, api_outfit_matcher, api_attribute, api_similar_mat
|
||||
router = APIRouter()
|
||||
|
||||
router.include_router(api_test.router, tags=["test"], prefix="/test")
|
||||
router.include_router(api_outfit_matcher.router, tags=["outfit_matcher"], prefix="/api/outfit_matcher")
|
||||
router.include_router(api_attribute.router, tags=["attribute"], prefix="/api/attribute")
|
||||
router.include_router(api_similar_match.router, tags=["similar_match"], prefix="/api/similar_match")
|
||||
router.include_router(api_process_lookbooks.router, tags=["process_lookbooks"], prefix="/api/process_lookbooks")
|
||||
router.include_router(api_outfit_matcher.router, tags=["outfit_matcher"], prefix="/api")
|
||||
router.include_router(api_attribute.router, tags=["attribute"], prefix="/api")
|
||||
router.include_router(api_similar_match.router, tags=["similar_match"], prefix="/api")
|
||||
router.include_router(api_process_lookbooks.router, tags=["process-lookbooks"], prefix="/api")
|
||||
|
||||
@@ -16,11 +16,11 @@ router = APIRouter()
|
||||
|
||||
|
||||
@RunTime
|
||||
@router.post("similar_match")
|
||||
@router.post("/similar_match")
|
||||
def similar_match(request_item: SimilarMatchMItem):
|
||||
try:
|
||||
if request_item.result_number <= 0:
|
||||
raise KeyError("result number can't be less than 0")
|
||||
raise KeyError("results number can't be less than 0")
|
||||
service = SimilarMatch(request_item)
|
||||
search_response = service.match_features()
|
||||
response_data = []
|
||||
@@ -36,4 +36,4 @@ def similar_match(request_item: SimilarMatchMItem):
|
||||
return {"message": "ok", "data": response_data}
|
||||
except KeyError as e:
|
||||
logger.warning(str(e))
|
||||
return {"message": "result number can't be less than 0", "data": []}
|
||||
return {"message": "results number can't be less than 0", "data": []}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import logging
|
||||
import os
|
||||
from typing import ClassVar
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from pydantic import BaseSettings
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
|
||||
logging.info(f"BASE_DIR : {BASE_DIR}")
|
||||
@@ -9,14 +11,14 @@ load_dotenv(os.path.join(BASE_DIR, '.env'))
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
PROJECT_NAME = os.getenv('PROJECT_NAME', 'FASTAPI BASE')
|
||||
SECRET_KEY = os.getenv('SECRET_KEY', '')
|
||||
API_PREFIX = ''
|
||||
BACKEND_CORS_ORIGINS = ['*']
|
||||
DATABASE_URL = os.getenv('SQL_DATABASE_URL', '')
|
||||
PROJECT_NAME: ClassVar[str] = 'FASTAPI BASE'
|
||||
SECRET_KEY: str = ''
|
||||
API_PREFIX: str = ''
|
||||
BACKEND_CORS_ORIGINS: list[str] = ['*']
|
||||
DATABASE_URL: str = ''
|
||||
ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # Token expired after 7 days
|
||||
SECURITY_ALGORITHM = 'HS256'
|
||||
LOGGING_CONFIG_FILE = os.path.join(BASE_DIR, 'logging_env.py')
|
||||
SECURITY_ALGORITHM: str = 'HS256'
|
||||
LOGGING_CONFIG_FILE: str = os.path.join(BASE_DIR, 'logging_env.py')
|
||||
|
||||
|
||||
settings = Settings()
|
||||
@@ -35,7 +37,7 @@ ATT_TRITON_PORT = "20010"
|
||||
|
||||
MILVUS_URL = "http://10.1.1.240:19530"
|
||||
|
||||
DEBUG = 1
|
||||
DEBUG = 2
|
||||
SHOW_OR_SAVE_result_image = False
|
||||
# service env : 1
|
||||
# pycharm debug : 2
|
||||
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user