增加删除推理集合接口
This commit is contained in:
@ -2,10 +2,10 @@ import threading
|
||||
import asyncio
|
||||
from typing import List
|
||||
from fastapi import APIRouter, Depends, UploadFile, File, Form
|
||||
from fastapi.responses import StreamingResponse
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.websocket.web_socket_server import room_manager
|
||||
from app.db.db_session import get_db
|
||||
from app.common import reponse_code as rc
|
||||
from app.model.crud import project_detect_crud as pdc
|
||||
@ -52,6 +52,18 @@ def add_detect(detect_in: ProjectDetectIn, session: Session = Depends(get_db)):
|
||||
return rc.response_success(msg="新增成功", data=detect.id)
|
||||
|
||||
|
||||
@detect.get("/del_detect/{detect_id}")
|
||||
def del_detect(detect_id: int, session: Session = Depends(get_db)):
|
||||
"""
|
||||
删除训练集合
|
||||
:param detect_id:
|
||||
:param session:
|
||||
:return:
|
||||
"""
|
||||
pds.del_detect(detect_id, session)
|
||||
return rc.response_success(msg="删除成功")
|
||||
|
||||
|
||||
@detect.post("/get_img_list")
|
||||
def get_img_list(detect_img_pager: ProjectDetectImgPager, session: Session = Depends(get_db)):
|
||||
"""
|
||||
@ -127,13 +139,15 @@ def run_detect_yolo(detect_log_in: ProjectDetectLogIn, session: Session = Depend
|
||||
detect_log.detect_version, detect_log.id, detect_log.detect_id, session,))
|
||||
thread_train.start()
|
||||
elif detect.file_type == 'rtsp':
|
||||
if detect_log_in.pt_type == 'best':
|
||||
weights_pt = train.best_pt
|
||||
else:
|
||||
weights_pt = train.last_pt
|
||||
thread_train = threading.Thread(target=run_rtsp_loop,
|
||||
args=(weights_pt, detect.rtsp_url, train.train_data, detect.id))
|
||||
thread_train.start()
|
||||
room = 'detect_rtsp_' + str(detect.id)
|
||||
if not room_manager.rooms.get(room):
|
||||
if detect_log_in.pt_type == 'best':
|
||||
weights_pt = train.best_pt
|
||||
else:
|
||||
weights_pt = train.last_pt
|
||||
thread_train = threading.Thread(target=run_rtsp_loop,
|
||||
args=(weights_pt, detect.rtsp_url, train.train_data, detect.id))
|
||||
thread_train.start()
|
||||
return rc.response_success(msg="执行成功")
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user