Upload 2 files
Browse files- Dockerfile +10 -1
- requirements.txt +6 -6
Dockerfile
CHANGED
|
@@ -4,12 +4,13 @@ FROM python:3.10-slim
|
|
| 4 |
# Ensure Python output is unbuffered
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
|
| 7 |
-
# 2. Install system dependencies for EasyOCR
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y --no-install-recommends \
|
| 10 |
libgl1 \
|
| 11 |
libgomp1 \
|
| 12 |
libsm6 libxext6 libxrender1 \
|
|
|
|
| 13 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
# 3. Set working directory
|
|
@@ -26,9 +27,17 @@ RUN mkdir -p /app/uploads && chmod -R 777 /app/uploads
|
|
| 26 |
RUN mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
|
| 27 |
RUN mkdir -p /app/easyocr_models && chmod -R 777 /app/easyocr_models
|
| 28 |
|
|
|
|
|
|
|
|
|
|
| 29 |
# 7. Copy all project files
|
| 30 |
COPY . .
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# 8. Environment variables
|
| 33 |
ENV PORT=7860
|
| 34 |
|
|
|
|
| 4 |
# Ensure Python output is unbuffered
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
|
| 7 |
+
# 2. Install system dependencies for EasyOCR, OpenCV, and OCR
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y --no-install-recommends \
|
| 10 |
libgl1 \
|
| 11 |
libgomp1 \
|
| 12 |
libsm6 libxext6 libxrender1 \
|
| 13 |
+
tesseract-ocr \
|
| 14 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
# 3. Set working directory
|
|
|
|
| 27 |
RUN mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
|
| 28 |
RUN mkdir -p /app/easyocr_models && chmod -R 777 /app/easyocr_models
|
| 29 |
|
| 30 |
+
# 🔧 NEW: Ensure all model and script files are readable
|
| 31 |
+
RUN chmod -R 755 /app
|
| 32 |
+
|
| 33 |
# 7. Copy all project files
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
+
# 🔧 NEW: Ensure models exist and have permissions
|
| 37 |
+
RUN chmod 644 /app/cnn_model.h5 || true
|
| 38 |
+
RUN chmod 644 /app/model.pkl || true
|
| 39 |
+
RUN chmod -R 755 /app/*.py || true
|
| 40 |
+
|
| 41 |
# 8. Environment variables
|
| 42 |
ENV PORT=7860
|
| 43 |
|
requirements.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
Flask
|
| 2 |
-
gunicorn # Production
|
| 3 |
numpy
|
| 4 |
pandas
|
| 5 |
scikit-learn
|
| 6 |
-
tensorflow
|
| 7 |
-
keras
|
| 8 |
-
easyocr
|
| 9 |
-
opencv-python-headless
|
| 10 |
-
pillow
|
|
|
|
| 1 |
Flask
|
| 2 |
+
gunicorn # Production WSGI server for Flask
|
| 3 |
numpy
|
| 4 |
pandas
|
| 5 |
scikit-learn
|
| 6 |
+
tensorflow==2.13.0 # Stable TensorFlow version for Python 3.10
|
| 7 |
+
keras==2.13.1 # Match TensorFlow version (important for compatibility)
|
| 8 |
+
easyocr
|
| 9 |
+
opencv-python-headless==4.8.1.78 # Headless version for servers
|
| 10 |
+
pillow
|