|
|
|
@ -518,10 +518,10 @@ async def process_image(image_url: str, current_user: dict = Depends(get_current
|
|
|
|
|
try:
|
|
|
|
|
if await is_text_dominant(client, image_url):
|
|
|
|
|
logger.info("检测到图片主要是文字内容,开始识别文字:")
|
|
|
|
|
return StreamingResponse(recognize_text(client, image_url), media_type="text/plain")
|
|
|
|
|
return StreamingResponse(recognize_text(client,app.state.mysql_pool, image_url), media_type="text/plain")
|
|
|
|
|
else:
|
|
|
|
|
print("检测到图片主要是物体/场景,开始识别内容:")
|
|
|
|
|
return StreamingResponse(recognize_content(client, image_url), media_type="text/plain")
|
|
|
|
|
return StreamingResponse(recognize_content(client,app.state.mysql_pool, image_url), media_type="text/plain")
|
|
|
|
|
except Exception as e:
|
|
|
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
|
|
|
|