fix : main.py

This commit is contained in:
zty 2024-10-29 17:20:48 +08:00
parent 694e52fef2
commit a334d5aac1
1 changed files with 1 additions and 4 deletions

View File

@ -284,7 +284,6 @@ async def extract_info(
ocr_text = "\n".join( ocr_text = "\n".join(
[line[1][0] for res in result if res is not None for line in res] [line[1][0] for res in result if res is not None for line in res]
) )
print("ocr_text", ocr_text)
# 提取信息 # 提取信息
if extract_method == "re": if extract_method == "re":
if file_type == "patent": if file_type == "patent":
@ -330,10 +329,8 @@ async def extract_info(
conf.CHAT_API, conf.CHAT_API,
json={"model": conf.CHAT_MODEL, "prompt": prompt, "stream": False}, json={"model": conf.CHAT_MODEL, "prompt": prompt, "stream": False},
) )
# info = json.loads((r.json()["response"]))
try: try:
# info = json.loads(r.json()["response"]) info = json.loads(r.json().get("response", {}))
info = r.json().get("response", {})
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
print(f"JSONDecodeError: {e}") print(f"JSONDecodeError: {e}")
return JSONResponse(content=info) return JSONResponse(content=info)