Features
Extract text content from images, supporting multiple image formats and languages.
How to Call
from services.ocr_service.client import OCRServiceClient
client = OCRServiceClient()
# 健康检查
status = client.health_check()
# OCR识别
image_base64 = client.image_to_base64("/path/to/image.jpg")
result = client.ocr(image_base64)
Get Recognition Results
texts = result["rec_texts"] # ["recognized text 1", "recognized text 2", ...] scores = result["rec_scores"] # [0.98, 0.95, ...]
## 返回格式
```json
{
"doc_preprocessor_res": {"angle": 0},
"dt_polys": [[x1,y1], [x2,y2], ...],
"rec_texts": ["识别的文字1", "识别的文字2"],
"rec_scores": [0.98, 0.95]
}
Field Descriptions
rec_texts: List of recognized textrec_scores: Confidence score for each text blockdt_polys: Coordinates of the detected text regions