dembasowmr commited on
Commit
ac5fcf7
·
1 Parent(s): 3f90406

Fix: Force pysqlite3 usage for ChromaDB compatibility

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -0
  2. compassia.py +11 -0
Dockerfile CHANGED
@@ -14,6 +14,8 @@ RUN apt-get update && apt-get install -y \
14
  tesseract-ocr \
15
  tesseract-ocr-eng \
16
  tesseract-ocr-tur \
 
 
17
  # Add other languages if needed, e.g., tesseract-ocr-all for all languages
18
  # If you remove apt_packages from requirements.txt, ensure these are here.
19
  && rm -rf /var/lib/apt/lists/*
 
14
  tesseract-ocr \
15
  tesseract-ocr-eng \
16
  tesseract-ocr-tur \
17
+ tesseract-ocr-fra \
18
+ tesseract-ocr-ara \
19
  # Add other languages if needed, e.g., tesseract-ocr-all for all languages
20
  # If you remove apt_packages from requirements.txt, ensure these are here.
21
  && rm -rf /var/lib/apt/lists/*
compassia.py CHANGED
@@ -5,6 +5,17 @@ import re
5
  import uuid # For generating unique IDs for ChromaDB
6
  from PIL import Image
7
 
 
 
 
 
 
 
 
 
 
 
 
8
  # For text extraction from PDFs (non-OCR)
9
  from pdfminer.high_level import extract_text_to_fp
10
  from pdfminer.layout import LAParams
 
5
  import uuid # For generating unique IDs for ChromaDB
6
  from PIL import Image
7
 
8
+ import sys
9
+ # IMPORTANT: These lines MUST be at the very top of compassia.py
10
+ # They ensure that any subsequent import of 'sqlite3' (even indirectly by chromadb)
11
+ # will use the version provided by pysqlite3-binary.
12
+ try:
13
+ import pysqlite3
14
+ sys.modules['sqlite3'] = pysqlite3
15
+ except ImportError:
16
+ pass # Fallback if pysqlite3 isn't available, but it should be in Docker
17
+
18
+
19
  # For text extraction from PDFs (non-OCR)
20
  from pdfminer.high_level import extract_text_to_fp
21
  from pdfminer.layout import LAParams