From a1c0de1dfe5c928a0aa2ee9b42f86cdd067d0729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A7=84=ED=98=84?= Date: Wed, 25 Sep 2024 22:03:09 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20color=20#=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ai/app/api/yolo/detection.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ai/app/api/yolo/detection.py b/ai/app/api/yolo/detection.py index ad2d94d..7c2bc31 100644 --- a/ai/app/api/yolo/detection.py +++ b/ai/app/api/yolo/detection.py @@ -1,5 +1,3 @@ -import json - from fastapi import APIRouter, HTTPException, Request from schemas.predict_request import PredictRequest from schemas.train_request import TrainRequest @@ -12,7 +10,6 @@ from utils.file_utils import get_dataset_root_path, process_directories, process from utils.slackMessage import send_slack_message from utils.api_utils import report_data import random -import asyncio, httpx router = APIRouter() @@ -63,7 +60,7 @@ def run_predictions(model, image, request, classes): def process_prediction_result(result, image, label_map): try: random_number = random.randint(0, 0xFFFFFF) - color = f"{random_number:06X}" + color = f"#{random_number:06X}" label_data = LabelData( version="0.0.0", @@ -92,7 +89,7 @@ def process_prediction_result(result, image, label_map): return PredictResponse( image_id=image.image_id, - data=json.dumps(label_data.dict()) + data=label_data.model_dump_json() )