taprosoft commited on
Commit
204f5db
·
1 Parent(s): 16e4c39

fix: update torch version

Browse files
Files changed (4) hide show
  1. Dockerfile +41 -0
  2. README.md +1 -3
  3. app.py +2 -2
  4. cuda_requirements.txt +2 -0
Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+
5
+ ENV PYTHONUNBUFFERED=1
6
+
7
+ RUN apt-get update && apt-get install --no-install-recommends -y \
8
+ build-essential \
9
+ python3.10-dev \
10
+ python3-pip \
11
+ git \
12
+ ffmpeg \
13
+ poppler-utils \
14
+ libpoppler-dev \
15
+ tesseract-ocr \
16
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
17
+
18
+ WORKDIR /code
19
+
20
+ COPY ./requirements.txt /code/requirements.txt
21
+
22
+ # Set up a new user named "user" with user ID 1000
23
+ RUN useradd -m -u 1000 user
24
+ # Switch to the "user" user
25
+ USER user
26
+ # Set home to the user's home directory
27
+ ENV HOME=/home/user \
28
+ PATH=/home/user/.local/bin:$PATH \
29
+ PYTHONPATH=$HOME/app \
30
+ PYTHONUNBUFFERED=1 \
31
+ GRADIO_SERVER_NAME=0.0.0.0
32
+
33
+ RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
34
+
35
+ # Set the working directory to the user's home directory
36
+ WORKDIR $HOME/app
37
+
38
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
39
+ COPY --chown=user . $HOME/app
40
+
41
+ CMD ["python3", "app.py"]
README.md CHANGED
@@ -3,9 +3,7 @@ title: PDFParsersPlayground
3
  emoji: 🐢
4
  colorFrom: blue
5
  colorTo: green
6
- sdk: gradio
7
- sdk_version: 5.7.1
8
- app_file: app.py
9
  pinned: false
10
  short_description: Convert PDFs to Markdown with open-source parsers
11
  ---
 
3
  emoji: 🐢
4
  colorFrom: blue
5
  colorTo: green
6
+ sdk: docker
 
 
7
  pinned: false
8
  short_description: Convert PDFs to Markdown with open-source parsers
9
  ---
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from utils import fix_problematic_imports # noqa
2
 
3
  fix_problematic_imports() # noqa
4
 
@@ -19,7 +19,7 @@ from backends import (
19
  from backends.settings import ENABLE_DEBUG_MODE
20
  from utils import remove_images_from_markdown, trim_pages
21
 
22
- TRIMMED_PDF_PATH = Path("/tmp/gradio/trim")
23
  TRIMMED_PDF_PATH.mkdir(exist_ok=True)
24
 
25
 
 
1
+ from utils import fix_problematic_imports
2
 
3
  fix_problematic_imports() # noqa
4
 
 
19
  from backends.settings import ENABLE_DEBUG_MODE
20
  from utils import remove_images_from_markdown, trim_pages
21
 
22
+ TRIMMED_PDF_PATH = Path("/tmp/trimmed_input")
23
  TRIMMED_PDF_PATH.mkdir(exist_ok=True)
24
 
25
 
cuda_requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ torch @ https://download.pytorch.org/whl/test/cu118/torch-2.6.0%2Bcu118-cp310-cp310-linux_x86_64.whl
2
+ torchvision @ https://download.pytorch.org/whl/test/cu118/torchvision-0.21.0%2Bcu118-cp310-cp310-linux_x86_64.whl