Spaces:
Sleeping
Sleeping
Upload 28 files
Browse files- ocr_service.py +6 -3
- routers/verify_address.py +5 -2
- routers/verify_agent_profile.py +5 -2
ocr_service.py
CHANGED
|
@@ -2,9 +2,12 @@ import searchworks
|
|
| 2 |
import sys
|
| 3 |
print(f"--- [DEBUG] OCR SERVICE PATH: {__file__} ---")
|
| 4 |
print(f"--- [DEBUG] SEARCHWORKS PATH: {searchworks.__file__} ---")
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
import logging
|
| 9 |
import numpy as np
|
| 10 |
from fastapi import FastAPI
|
|
|
|
| 2 |
import sys
|
| 3 |
print(f"--- [DEBUG] OCR SERVICE PATH: {__file__} ---")
|
| 4 |
print(f"--- [DEBUG] SEARCHWORKS PATH: {searchworks.__file__} ---")
|
| 5 |
+
try:
|
| 6 |
+
with open("ocr_service_running.txt", "w") as f:
|
| 7 |
+
f.write(f"RUNNING: {__file__}\n")
|
| 8 |
+
f.write(f"SEARCHWORKS: {searchworks.__file__}\n")
|
| 9 |
+
except Exception as e:
|
| 10 |
+
print(f"--- [WARNING] Could not write ocr_service_running.txt: {e} ---")
|
| 11 |
import logging
|
| 12 |
import numpy as np
|
| 13 |
from fastapi import FastAPI
|
routers/verify_address.py
CHANGED
|
@@ -53,8 +53,11 @@ async def verify_address(
|
|
| 53 |
extracted_text = "\n".join(results)
|
| 54 |
print(f"--- [PERF] Address OCR took {time.time() - start_time:.2f}s ---")
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
normalized_extracted = normalize_text(extracted_text)
|
| 60 |
|
|
|
|
| 53 |
extracted_text = "\n".join(results)
|
| 54 |
print(f"--- [PERF] Address OCR took {time.time() - start_time:.2f}s ---")
|
| 55 |
|
| 56 |
+
try:
|
| 57 |
+
with open("last_ocr_debug_address.txt", "w", encoding="utf-8") as debug_file:
|
| 58 |
+
debug_file.write(extracted_text)
|
| 59 |
+
except Exception as e:
|
| 60 |
+
print(f"--- [WARNING] Could not write last_ocr_debug_address.txt: {e} ---")
|
| 61 |
|
| 62 |
normalized_extracted = normalize_text(extracted_text)
|
| 63 |
|
routers/verify_agent_profile.py
CHANGED
|
@@ -52,8 +52,11 @@ async def verify_agent_profile(
|
|
| 52 |
extracted_text = "\n".join(results)
|
| 53 |
logger.info(f"--- [PERF] Agent Profile OCR took {time.time() - start_time:.2f}s ---")
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
normalized_extracted = normalize_text(extracted_text)
|
| 59 |
|
|
|
|
| 52 |
extracted_text = "\n".join(results)
|
| 53 |
logger.info(f"--- [PERF] Agent Profile OCR took {time.time() - start_time:.2f}s ---")
|
| 54 |
|
| 55 |
+
try:
|
| 56 |
+
with open("last_ocr_debug_agent_profile.txt", "w", encoding="utf-8") as debug_file:
|
| 57 |
+
debug_file.write(extracted_text)
|
| 58 |
+
except Exception as e:
|
| 59 |
+
logger.warning(f"Could not write last_ocr_debug_agent_profile.txt: {e}")
|
| 60 |
|
| 61 |
normalized_extracted = normalize_text(extracted_text)
|
| 62 |
|