Spaces:
Sleeping
Sleeping
Commit
·
422f10d
1
Parent(s):
dbf9b27
Update PDF to Markdown converter API with NVIDIA L4 support
Browse files- Dockerfile +11 -27
- requirements.txt +5 -5
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
FROM nvidia/cuda:
|
2 |
|
3 |
ENV DEBIAN_FRONTEND=noninteractive
|
4 |
|
@@ -31,33 +31,17 @@ WORKDIR /app
|
|
31 |
# Copy requirements first
|
32 |
COPY requirements.txt .
|
33 |
|
34 |
-
# Install PyTorch dependencies with
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
38 |
|
39 |
-
#
|
40 |
-
|
41 |
|
42 |
-
#
|
43 |
-
RUN grep -v "torch\|torchvision\|torchaudio\|transformers" requirements.txt > requirements_no_torch.txt && \
|
44 |
-
pip install --no-cache-dir -r requirements_no_torch.txt
|
45 |
-
|
46 |
-
# Create output directories
|
47 |
-
RUN mkdir -p /app/output/images && \
|
48 |
-
chmod -R 777 /app/output
|
49 |
-
|
50 |
-
# Copy application code
|
51 |
-
COPY app/ /app/app/
|
52 |
-
COPY pdf_converter/ /app/pdf_converter/
|
53 |
-
COPY app.py .
|
54 |
-
|
55 |
-
# Set environment variables for GPU
|
56 |
-
ENV NVIDIA_VISIBLE_DEVICES=all
|
57 |
-
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
58 |
-
|
59 |
-
# Expose port 7860 for Hugging Face Spaces
|
60 |
EXPOSE 7860
|
61 |
|
62 |
-
# Command to run the application
|
63 |
-
CMD ["python3", "app.
|
|
|
1 |
+
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
2 |
|
3 |
ENV DEBIAN_FRONTEND=noninteractive
|
4 |
|
|
|
31 |
# Copy requirements first
|
32 |
COPY requirements.txt .
|
33 |
|
34 |
+
# Install PyTorch dependencies with explicit compatible versions for NVIDIA L4
|
35 |
+
RUN pip3 install --no-cache-dir --upgrade pip && \
|
36 |
+
pip3 install --no-cache-dir torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121 && \
|
37 |
+
pip3 install --no-cache-dir transformers==4.36.2 && \
|
38 |
+
pip3 install --no-cache-dir -r requirements.txt
|
39 |
|
40 |
+
# Copy the rest of the application
|
41 |
+
COPY . .
|
42 |
|
43 |
+
# Expose port
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
EXPOSE 7860
|
45 |
|
46 |
+
# Command to run the application
|
47 |
+
CMD ["python3", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
requirements.txt
CHANGED
@@ -2,8 +2,8 @@ fastapi==0.104.1
|
|
2 |
uvicorn==0.23.2
|
3 |
python-multipart==0.0.6
|
4 |
marker-pdf==1.6.2
|
5 |
-
#
|
6 |
-
# torch==2.
|
7 |
-
# torchvision==0.
|
8 |
-
# torchaudio==2.
|
9 |
-
# transformers==4.
|
|
|
2 |
uvicorn==0.23.2
|
3 |
python-multipart==0.0.6
|
4 |
marker-pdf==1.6.2
|
5 |
+
# PyTorch packages installed directly in Dockerfile
|
6 |
+
# torch==2.1.2
|
7 |
+
# torchvision==0.16.2
|
8 |
+
# torchaudio==2.1.2
|
9 |
+
# transformers==4.36.2
|