Fix: color # 수정

This commit is contained in:
김진현 2024-09-25 22:03:09 +09:00
parent 7fcc0d9c28
commit a1c0de1dfe

View File

@ -1,5 +1,3 @@
import json
from fastapi import APIRouter, HTTPException, Request from fastapi import APIRouter, HTTPException, Request
from schemas.predict_request import PredictRequest from schemas.predict_request import PredictRequest
from schemas.train_request import TrainRequest 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.slackMessage import send_slack_message
from utils.api_utils import report_data from utils.api_utils import report_data
import random import random
import asyncio, httpx
router = APIRouter() router = APIRouter()
@ -63,7 +60,7 @@ def run_predictions(model, image, request, classes):
def process_prediction_result(result, image, label_map): def process_prediction_result(result, image, label_map):
try: try:
random_number = random.randint(0, 0xFFFFFF) random_number = random.randint(0, 0xFFFFFF)
color = f"{random_number:06X}" color = f"#{random_number:06X}"
label_data = LabelData( label_data = LabelData(
version="0.0.0", version="0.0.0",
@ -92,7 +89,7 @@ def process_prediction_result(result, image, label_map):
return PredictResponse( return PredictResponse(
image_id=image.image_id, image_id=image.image_id,
data=json.dumps(label_data.dict()) data=label_data.model_dump_json()
) )