feat: update model name
This commit is contained in:
@@ -527,7 +527,7 @@ class MineruOCRService(OCRServiceBase):
|
||||
messages = [{"role": "user", "content": [{"type": "image_url", "image_url": {"url": image_url}}, {"type": "text", "text": prompt}]}]
|
||||
|
||||
response = self.openai_client.chat.completions.create(
|
||||
model="PaddlePaddle/PaddleOCR-VL",
|
||||
model="PaddleOCR-VL-0.9B", # Use exact model name from vLLM server
|
||||
messages=messages,
|
||||
temperature=0.0,
|
||||
)
|
||||
@@ -553,31 +553,15 @@ class MineruOCRService(OCRServiceBase):
|
||||
if not image_pattern.search(markdown_content):
|
||||
return markdown_content
|
||||
|
||||
print(f"[DEBUG] Found image reference in markdown, triggering PaddleOCR-VL recognition")
|
||||
formula_text = self._recognize_formula_with_paddleocr_vl(original_image)
|
||||
|
||||
try:
|
||||
# For now, use the entire image for formula recognition
|
||||
# TODO: Extract specific regions if image paths contain coordinates
|
||||
formula_text = self._recognize_formula_with_paddleocr_vl(original_image)
|
||||
if formula_text.startswith("\[") or formula_text.startswith("\("):
|
||||
formula_text = formula_text.replace("\[", "$$").replace("\(", "$$")
|
||||
formula_text = formula_text.replace("\]", "$$").replace("\)", "$$")
|
||||
else:
|
||||
formula_text = f"$${formula_text}$$"
|
||||
|
||||
print(f"[DEBUG] PaddleOCR-VL recognized formula: {formula_text[:100] if formula_text else 'Empty'}...")
|
||||
|
||||
# Replace image references with recognized formulas
|
||||
# Wrap in display math delimiters if not already wrapped
|
||||
if formula_text and not formula_text.startswith("$$"):
|
||||
formula_text = f"$${formula_text}$$"
|
||||
|
||||
markdown_content = image_pattern.sub(formula_text, markdown_content)
|
||||
print(f"[DEBUG] Formula recognition successful, updated markdown")
|
||||
|
||||
except Exception as e:
|
||||
# If formula recognition fails, keep original content and log error
|
||||
import traceback
|
||||
|
||||
print(f"[ERROR] Formula recognition failed: {e}")
|
||||
print(f"[ERROR] Traceback: {traceback.format_exc()}")
|
||||
|
||||
return markdown_content
|
||||
return formula_text
|
||||
|
||||
def recognize(self, image: np.ndarray) -> dict:
|
||||
"""Recognize content using local file_parse API.
|
||||
|
||||
Reference in New Issue
Block a user