fix: timeout VLM 15→60s + OCR zone élargie autour de l'ancre
Some checks failed
security-audit / Bandit (scan statique) (push) Successful in 12s
security-audit / pip-audit (CVE dépendances) (push) Successful in 10s
security-audit / Scan secrets (grep) (push) Successful in 8s
tests / Lint (ruff + black) (push) Successful in 14s
tests / Tests unitaires (sans GPU) (push) Failing after 14s
tests / Tests sécurité (critique) (push) Has been skipped
Some checks failed
security-audit / Bandit (scan statique) (push) Successful in 12s
security-audit / pip-audit (CVE dépendances) (push) Successful in 10s
security-audit / Scan secrets (grep) (push) Successful in 8s
tests / Lint (ruff + black) (push) Successful in 14s
tests / Tests unitaires (sans GPU) (push) Failing after 14s
tests / Tests sécurité (critique) (push) Has been skipped
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -199,10 +199,20 @@ def select_anchor():
|
||||
thumbnail.save(thumbnail_path, 'PNG')
|
||||
|
||||
# ── Analyse automatique du crop : OCR + VLM ────────────────────
|
||||
# Zone élargie autour de l'ancre pour capturer le texte à côté
|
||||
margin = 50
|
||||
expanded = img.crop((
|
||||
max(0, x - margin),
|
||||
max(0, y - margin),
|
||||
min(img.width, x + w + margin * 3),
|
||||
min(img.height, y + h + margin)
|
||||
))
|
||||
target_text = ""
|
||||
ocr_description = ""
|
||||
try:
|
||||
from services.ocr_service import ocr_extract_text
|
||||
target_text = ocr_extract_text(expanded).strip()
|
||||
if not target_text:
|
||||
target_text = ocr_extract_text(thumbnail).strip()
|
||||
print(f"🔍 [OCR] Texte extrait de l'ancre: '{target_text}'")
|
||||
|
||||
@@ -226,7 +236,7 @@ def select_anchor():
|
||||
"stream": False,
|
||||
"options": {"temperature": 0.1, "num_predict": 15}
|
||||
},
|
||||
timeout=15
|
||||
timeout=60
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
ocr_description = resp.json().get("response", "").strip()
|
||||
|
||||
Reference in New Issue
Block a user