FIX 修复返回值问题

This commit is contained in:
kyj@bowong.ai 2025-06-25 19:00:58 +08:00
parent f29430bf00
commit 45cbe7db3a
2 changed files with 25 additions and 25 deletions

View File

@ -209,29 +209,29 @@ async def inference_gemini(data: GeminiRequest, headers: Annotated[BundleHeaders
return ModalTaskResponse(success=True, taskId=fn_call.object_id) return ModalTaskResponse(success=True, taskId=fn_call.object_id)
# @router.post('/inference_gemini_first_only', summary="使用Gemini推理hls视频流指定时间段的打点情况-仅第一阶段") @router.post('/inference_gemini_first_only', summary="使用Gemini推理hls视频流指定时间段的打点情况-仅第一阶段")
# async def inference_gemini_first_only(data: GeminiRequestFirstOnly, async def inference_gemini_first_only(data: GeminiRequestFirstOnly,
# headers: Annotated[BundleHeaders, Header()], ) -> ModalTaskResponse: headers: Annotated[BundleHeaders, Header()], ) -> ModalTaskResponse:
# google_api_key = headers.x_google_api_key or os.environ.get("GOOGLE_API_KEY") google_api_key = headers.x_google_api_key or os.environ.get("GOOGLE_API_KEY")
# if not google_api_key: if not google_api_key:
# raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Missing Google API Key") raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Missing Google API Key")
# fn = modal.Function.from_name(config.modal_app_name, "video_inference_first_only", fn = modal.Function.from_name(config.modal_app_name, "video_inference_first_only",
# environment_name=config.modal_environment) environment_name=config.modal_environment)
# fn_call = fn.spawn(google_api_key, data.product_cover_grid_uri_list, data.product_list) fn_call = fn.spawn(google_api_key, data.product_cover_grid_uri_list, data.product_list)
# return ModalTaskResponse(success=True, taskId=fn_call.object_id) return ModalTaskResponse(success=True, taskId=fn_call.object_id)
#
#
# @router.post('/inference_gemini_second_only', summary="使用Gemini推理hls视频流指定时间段的打点情况-仅第二阶段") @router.post('/inference_gemini_second_only', summary="使用Gemini推理hls视频流指定时间段的打点情况-仅第二阶段")
# async def inference_gemini_second_only(data: GeminiRequestSecondOnly, async def inference_gemini_second_only(data: GeminiRequestSecondOnly,
# headers: Annotated[BundleHeaders, Header()], ) -> ModalTaskResponse: headers: Annotated[BundleHeaders, Header()], ) -> ModalTaskResponse:
# google_api_key = headers.x_google_api_key or os.environ.get("GOOGLE_API_KEY") google_api_key = headers.x_google_api_key or os.environ.get("GOOGLE_API_KEY")
# if not google_api_key: if not google_api_key:
# raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Missing Google API Key") raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Missing Google API Key")
# fn = modal.Function.from_name(config.modal_app_name, "video_inference_second_only", fn = modal.Function.from_name(config.modal_app_name, "video_inference_second_only",
# environment_name=config.modal_environment) environment_name=config.modal_environment)
# fn_call = fn.spawn(data.media_hls_url, google_api_key, data.identified_product_list, data.start_time, fn_call = fn.spawn(data.media_hls_url, google_api_key, data.identified_product_list, data.start_time,
# data.end_time, data.scale, data.options, data.prompt_label, data.last_product_text) data.end_time, data.scale, data.options, data.prompt_label, data.last_product_text)
# return ModalTaskResponse(success=True, taskId=fn_call.object_id) return ModalTaskResponse(success=True, taskId=fn_call.object_id)
@router.get("/inference_gemini/{task_id}", summary="查询Gemini推理hls视频流指定时间段的打点任务") @router.get("/inference_gemini/{task_id}", summary="查询Gemini推理hls视频流指定时间段的打点任务")

View File

@ -562,7 +562,7 @@ with (downloader_image.imports()):
logger.info( logger.info(
f"🥳一阶段推理完成JSON \n{json.dumps(identified_product_list, indent=4, ensure_ascii=False)}") f"🥳一阶段推理完成JSON \n{json.dumps(identified_product_list, indent=4, ensure_ascii=False)}")
logger.success("🎉推理完成") logger.success("🎉推理完成")
return identified_product_list return identified_product_list, None
@app.function(cpu=(0.5, 64), timeout=1800, @app.function(cpu=(0.5, 64), timeout=1800,
@ -640,7 +640,7 @@ with (downloader_image.imports()):
f"🥳二阶段推理完成JSON \n{json.dumps(product_timeline_info, indent=4, ensure_ascii=False)}") f"🥳二阶段推理完成JSON \n{json.dumps(product_timeline_info, indent=4, ensure_ascii=False)}")
logger.success("🎉推理完成") logger.success("🎉推理完成")
return product_timeline_info return product_timeline_info, None
@app.function(cpu=(0.5, 64), timeout=1800, @app.function(cpu=(0.5, 64), timeout=1800,