Skip to content

Commit

Permalink
Merge pull request #11 from natrontech/laubj
Browse files Browse the repository at this point in the history
feat: add gpu support
  • Loading branch information
janlauber authored Jul 1, 2024
2 parents 21bde15 + 1ea81a5 commit 7e065c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions streamlit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# Use a smaller base image with slim variant
FROM python:3.12-slim
# Use an NVIDIA CUDA base image with Python 3.12 support
FROM nvidia/cuda:12.5.0-runtime-ubuntu22.04

# Set working directory
WORKDIR /app

# Install necessary system dependencies and Tesseract
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \
python3-dev \
build-essential \
curl \
git \
tesseract-ocr \
tesseract-ocr-deu \
libtesseract-dev \
libheif-dev \
libsm6 \
libxext6 \
libxrender-dev \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*

# Copy application files
COPY . .

# Install Python dependencies separately to optimize layer caching and memory usage
RUN pip install --no-cache-dir -r requirements.txt
RUN pip3 install --upgrade pip && pip3 install --no-cache-dir -r requirements.txt

# Clean up unnecessary files and caches
RUN apt-get purge -y build-essential git \
Expand Down
2 changes: 1 addition & 1 deletion streamlit/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

@st.cache_resource
def load_ocr_reader():
return easyocr.Reader(["de"]) # Initialize the OCR reader for German
return easyocr.Reader(["de"], gpu=True) # Initialize the OCR reader for German


def denoise(image):
Expand Down

0 comments on commit 7e065c7

Please sign in to comment.