From a568149164217cbf4d67310a2395e12c7ed46706 Mon Sep 17 00:00:00 2001 From: liuyuanchuang Date: Mon, 9 Feb 2026 22:26:31 +0800 Subject: [PATCH] fix: update paddle-ocr url --- app/core/dependencies.py | 4 ++-- app/services/ocr_service.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/core/dependencies.py b/app/core/dependencies.py index 3a3468f..494538b 100644 --- a/app/core/dependencies.py +++ b/app/core/dependencies.py @@ -50,12 +50,12 @@ def get_mineru_ocr_service() -> MineruOCRService: """Get a MinerOCR service instance.""" settings = get_settings() api_url = getattr(settings, "miner_ocr_api_url", "http://127.0.0.1:8000/file_parse") - paddleocr_vl_url = getattr(settings, "paddleocr_vl_url", "http://localhost:8001/v1") + glm_ocr_url = getattr(settings, "glm_ocr_url", "http://localhost:8002/v1") return MineruOCRService( api_url=api_url, converter=get_converter(), image_processor=get_image_processor(), - paddleocr_vl_url=paddleocr_vl_url, + glm_ocr_url=glm_ocr_url, ) diff --git a/app/services/ocr_service.py b/app/services/ocr_service.py index 2f65b91..28e571a 100644 --- a/app/services/ocr_service.py +++ b/app/services/ocr_service.py @@ -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")}