File size: 1,093 Bytes
cc0c049
 
 
 
 
 
d725dbc
cc0c049
 
 
 
 
 
 
 
 
21e0c1e
cc0c049
 
 
 
 
 
 
 
 
 
 
 
21e0c1e
 
cc0c049
d979d70
 
 
cc0c049
d725dbc
cc0c049
 
d725dbc
cc0c049
 
 
 
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
44
# Use an official Python runtime as the base image
FROM python:3.8-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    tesseract-ocr \
    libtesseract-dev \
    poppler-utils \
    && rm -rf /var/lib/apt/lists/*

# Copy application code
COPY . /app

# Install Python dependencies, including sentencepiece and accelerate
RUN pip install --no-cache-dir \
    flask \
    flask-cors \
    pdfplumber \
    pillow \
    pytesseract \
    numpy \
    torch \
    transformers \
    datasets \
    scikit-learn \
    gunicorn \
    sentencepiece \
    accelerate

# Create uploads, cache, and fine-tuning directories with proper permissions
RUN mkdir -p /app/uploads /app/cache /app/pegasus_finetune /app/bert_finetune /app/legalbert_finetune && \
    chmod -R 777 /app/uploads /app/cache /app/pegasus_finetune /app/bert_finetune /app/legalbert_finetune

# Set environment variable for Hugging Face cache
ENV HF_HOME=/app/cache

# Expose port
EXPOSE 5000

# Run with Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]