File size: 1,025 Bytes
52a0fe9
 
 
 
 
 
 
 
 
 
 
 
 
 
e2cf7f5
52a0fe9
 
 
 
 
 
 
 
 
 
 
 
 
3538a1e
02b5142
52a0fe9
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Use a lean Python 3.10 image as base
FROM python:3.10-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive

# Set working directory
WORKDIR /app

# Install system dependencies for OCR and NLP
RUN apt-get update && apt-get install -y \
    tesseract-ocr \
    libgl1 \
    libglib2.0-0 \
    build-essential \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Download spaCy model during build to improve runtime performance
RUN python -m spacy download en_core_web_sm
RUN python -m nltk.downloader wordnet
RUN python -m nltk.downloader punkt

# Create uploads directory
RUN mkdir -p /app/uploads

# Copy the rest of the application code
COPY . .

# Expose the API port for Hugging Face Spaces
EXPOSE 7860

# Start the application using Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]