|
|
@@ -76,13 +76,14 @@ class DocumentProcessingService:
|
|
|
return result
|
|
|
|
|
|
async def pure_ocr(
|
|
|
- self, image_bytes: bytes, ocr_options: Dict = None
|
|
|
+ self, image_bytes: bytes, file_type: int = 1, ocr_options: Dict = None
|
|
|
) -> Dict[str, Any]:
|
|
|
"""
|
|
|
扫描图片并返回OCR识别结果
|
|
|
|
|
|
Args:
|
|
|
image_bytes: 图片字节
|
|
|
+ file_type: 文件类型,1: 图片, 0: PDF
|
|
|
ocr_options: OCR选项
|
|
|
|
|
|
Returns:
|
|
|
@@ -90,7 +91,7 @@ class DocumentProcessingService:
|
|
|
"""
|
|
|
# 1. OCR识别
|
|
|
ocr_result = await self.ocr_service.recognize_image_async(
|
|
|
- image_bytes, **(ocr_options or {})
|
|
|
+ image_bytes, file_type, **(ocr_options or {})
|
|
|
)
|
|
|
|
|
|
# 2. 提取文本
|