Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gpu support #11

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading