fix: update paddle-ocr url

This commit is contained in:
liuyuanchuang
2026-02-09 22:26:31 +08:00
parent f64bf25f67
commit a568149164
2 changed files with 8 additions and 8 deletions

View File

@@ -598,7 +598,7 @@ class MineruOCRService(OCRServiceBase):
api_url: str = "http://127.0.0.1:8000/file_parse",
image_processor: Optional[ImageProcessor] = None,
converter: Optional[Converter] = None,
paddleocr_vl_url: str = "http://localhost:8001/v1",
glm_ocr_url: str = "http://localhost:8002/v1",
layout_detector: Optional[LayoutDetector] = None,
):
"""Initialize Local API service.
@@ -606,13 +606,13 @@ class MineruOCRService(OCRServiceBase):
Args:
api_url: URL of the local file_parse API endpoint.
converter: Optional converter instance for format conversion.
paddleocr_vl_url: URL of the PaddleOCR-VL vLLM server.
glm_ocr_url: URL of the GLM-OCR vLLM server.
"""
self.api_url = api_url
self.image_processor = image_processor
self.converter = converter
self.paddleocr_vl_url = paddleocr_vl_url
self.openai_client = OpenAI(api_key="EMPTY", base_url=paddleocr_vl_url, timeout=3600)
self.glm_ocr_url = glm_ocr_url
self.openai_client = OpenAI(api_key="EMPTY", base_url=glm_ocr_url, timeout=3600)
def _recognize_formula_with_paddleocr_vl(self, image: np.ndarray, prompt: str = "Formula Recognition:") -> str:
"""Recognize formula using PaddleOCR-VL API.
@@ -687,10 +687,10 @@ class MineruOCRService(OCRServiceBase):
image_bytes.seek(0)
image_data = np.frombuffer(image_bytes.read(), dtype=np.uint8)
original_image = cv2.imdecode(image_data, cv2.IMREAD_COLOR)
# Reset image_bytes for API request
image_bytes.seek(0)
# Prepare multipart form data
files = {"files": ("image.png", image_bytes, "image/png")}