fix: ocr fetch bug fix

This commit is contained in:
arkohut 2024-09-11 23:20:42 +08:00
parent dbbc2792ef
commit d98eab9ebd

View File

@ -96,12 +96,8 @@ async def predict(img_path):
return None
async with httpx.AsyncClient() as client:
headers = {}
if token:
headers["Authorization"] = f"Bearer {token}"
async with semaphore:
ocr_result = await fetch(endpoint, client, image_base64, headers=headers)
return ocr_result
headers = {"Authorization": f"Bearer {token}"} if token else {}
return await fetch(endpoint, client, image_base64, headers)
@router.get("/")