Commit f80949a5 authored by zhougaofeng's avatar zhougaofeng
Browse files

Update pdf_client.py

parent 0a43c18c
...@@ -18,16 +18,11 @@ class ocrPdfClient: ...@@ -18,16 +18,11 @@ class ocrPdfClient:
"path": str(path), "path": str(path),
"output_dir": str(output_dir), "output_dir": str(output_dir),
} }
file_name_without_extension, _ = os.path.splitext(os.path.basename(path)) logger.info(f'reading: {path}')
logger.info(
f'pdf_server: {self.api_url}, pdf path: {path}'
)
try: try:
response = requests.post(f"{self.api_url}/pdf_ocr", json=payload) response = requests.post(f"{self.api_url}/pdf_ocr", json=payload)
#logger.info(f'response:{response.json()}')
output_dir = response.json()['output_path'] output_dir = response.json()['output_path']
response.raise_for_status() response.raise_for_status()
#logger.info(f'output_dir:{output_dir}')
return output_dir if response.json()['status_code'] == 200 else None return output_dir if response.json()['status_code'] == 200 else None
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
logger.error(f"OCR PDF API request failed: {e}") logger.error(f"OCR PDF API request failed: {e}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment