"src/lib/vscode:/vscode.git/clone" did not exist on "1091ee5a9b75dd2b796d30bf4c3070b6ca0fb9c1"
Commit f80949a5 authored by zhougaofeng's avatar zhougaofeng
Browse files

Update pdf_client.py

parent 0a43c18c
......@@ -18,21 +18,16 @@ class ocrPdfClient:
"path": str(path),
"output_dir": str(output_dir),
}
file_name_without_extension, _ = os.path.splitext(os.path.basename(path))
logger.info(
f'pdf_server: {self.api_url}, pdf path: {path}'
)
logger.info(f'reading: {path}')
try:
response = requests.post(f"{self.api_url}/pdf_ocr", json=payload)
#logger.info(f'response:{response.json()}')
output_dir = response.json()['output_path']
response.raise_for_status()
#logger.info(f'output_dir:{output_dir}')
return output_dir if response.json()['status_code'] == 200 else None
except requests.exceptions.RequestException as e:
logger.error(f"OCR PDF API request failed: {e}")
return None
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
......
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