690604:1208 ADR-034-134 #08
This commit is contained in:
@@ -607,8 +607,8 @@ export default function OcrSandboxPromptManager() {
|
|||||||
OCR Raw Text (Step 1 Result)
|
OCR Raw Text (Step 1 Result)
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<Badge variant="outline" className="text-xs">
|
<Badge variant="outline" className="text-xs">
|
||||||
{ocrResult.engineUsed === 'typhoon-ocr-3b'
|
{ocrResult.engineUsed === 'typhoon-np-dms-ocr'
|
||||||
? 'Typhoon OCR-3B'
|
? 'Typhoon OCR'
|
||||||
: ocrResult.ocrUsed
|
: ocrResult.ocrUsed
|
||||||
? 'Tesseract'
|
? 'Tesseract'
|
||||||
: 'Fast Path (Text Layer)'}
|
: 'Fast Path (Text Layer)'}
|
||||||
|
|||||||
@@ -234,7 +234,19 @@ def process_with_typhoon_ocr(pil_image: Image.Image, options_override: dict = {}
|
|||||||
response = client.post(f"{OLLAMA_API_URL}/api/generate", json=payload)
|
response = client.post(f"{OLLAMA_API_URL}/api/generate", json=payload)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = response.json()
|
data = response.json()
|
||||||
return str(data.get("response", "")).strip()
|
result_text = str(data.get("response", "")).strip()
|
||||||
|
logger.info(
|
||||||
|
f"[DIAG] Ollama response — model={model_name} "
|
||||||
|
f"textLen={len(result_text)} "
|
||||||
|
f"done={data.get('done')} "
|
||||||
|
f"done_reason={data.get('done_reason')} "
|
||||||
|
f"eval_count={data.get('eval_count', 0)}"
|
||||||
|
)
|
||||||
|
if not result_text:
|
||||||
|
logger.warning(
|
||||||
|
f"[DIAG] Ollama returned empty response — full response keys: {list(data.keys())}"
|
||||||
|
)
|
||||||
|
return result_text
|
||||||
|
|
||||||
|
|
||||||
@app.post("/ocr", response_model=OcrResponse, dependencies=[Depends(get_api_key)])
|
@app.post("/ocr", response_model=OcrResponse, dependencies=[Depends(get_api_key)])
|
||||||
|
|||||||
Reference in New Issue
Block a user