21 lines
1.1 KiB
Python
21 lines
1.1 KiB
Python
"""Central config cho Vision OCR service — nơi DUY NHẤT giữ cấu hình OCRFlux.
|
|
Đổi base_url / model / prompt chỉ cần sửa file này (docling & markitdown gọi qua HTTP)."""
|
|
import os
|
|
|
|
# llama-server (OCRFlux-3B) qua SSH tunnel; Docker reach host qua host.docker.internal
|
|
LLM_BASE_URL = os.getenv("LLM_BASE_URL", "http://host.docker.internal:11436/v1")
|
|
LLM_MODEL = os.getenv("LLM_MODEL", "ggml-org/Qwen2.5-VL-3B-Instruct-GGUF")
|
|
|
|
# OCRFlux page-to-markdown prompt (model fine-tuned để trả lời đúng prompt này bằng JSON)
|
|
OCRFLUX_PROMPT = (
|
|
"Below is the image of one page of a document. Just return the plain text "
|
|
"representation of this document as if you were reading it naturally.\n"
|
|
"ALL tables should be presented in HTML format.\n"
|
|
"Present all titles and headings as H1 headings.\n"
|
|
"Do not hallucinate.\n"
|
|
)
|
|
|
|
# Ảnh nhỏ hơn ngưỡng này (px chiều rộng) sẽ được upscale để model đọc rõ email crop nhỏ
|
|
MIN_WIDTH_PX = int(os.getenv("VISION_MIN_WIDTH_PX", "1200"))
|
|
MAX_TOKENS = int(os.getenv("VISION_MAX_TOKENS", "1500"))
|