Hamid191 commited on
Commit
91209c6
·
verified ·
1 Parent(s): 3f4e029

Update ingestion/ingestor.py

Browse files
Files changed (1) hide show
  1. ingestion/ingestor.py +6 -0
ingestion/ingestor.py CHANGED
@@ -56,8 +56,14 @@ class HaqeeqatIngestor:
56
 
57
  def _ingest_image(self, path: str) -> dict:
58
  ocr_text = self.ocr_engine.extract_text(path)
 
59
  metadata = self._base_metadata()
60
  metadata["frames_sampled"] = 1
 
 
 
 
 
61
  return {
62
  "file_type": "image",
63
  "audio_transcript": "",
 
56
 
57
  def _ingest_image(self, path: str) -> dict:
58
  ocr_text = self.ocr_engine.extract_text(path)
59
+ garbled = utils.is_ocr_garbled(ocr_text)
60
  metadata = self._base_metadata()
61
  metadata["frames_sampled"] = 1
62
+ metadata["ocr_garbled"] = garbled
63
+ if garbled:
64
+ metadata["warnings"] = metadata.get("warnings", []) + [
65
+ "OCR produced garbled output; results may be unreliable"
66
+ ]
67
  return {
68
  "file_type": "image",
69
  "audio_transcript": "",