Jaiwincr7 commited on
Commit
8b0f257
·
1 Parent(s): 31c3e13

FIX: Updated Dockerfile to explicitly install CPU PyTorch

Browse files
Files changed (2) hide show
  1. Dockerfile +18 -11
  2. requirements.txt +5 -2
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- # Use a Python base image
2
- FROM python:3.10-slim
3
 
4
  # Set the working directory
5
  WORKDIR /app
@@ -9,19 +9,26 @@ EXPOSE 8501
9
 
10
  # Copy the requirements file and install dependencies
11
  COPY requirements.txt .
 
 
 
12
 
13
- # Install dependencies. We use specific indexes for PyTorch to ensure compatibility
14
- # and a general upgrade to avoid issues.
 
15
  RUN pip install --upgrade pip
 
 
 
 
 
 
 
 
 
16
  RUN pip install -r requirements.txt
17
 
18
- # Copy the rest of the application code
19
- # Assuming the user saved the provided code blocks into these files
20
- COPY main.py .
21
- COPY merged.py .
22
- COPY app.py .
23
 
24
  # Command to run the Streamlit application
25
- # We use --server.port 8501 to match the exposed port
26
- # and --server.address 0.0.0.0 to make it accessible outside the container
27
  CMD ["streamlit", "run", "app.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
 
1
+ # Use a Debian-based Python image. This is often more stable for PyTorch than 'slim'.
2
+ FROM python:3.10
3
 
4
  # Set the working directory
5
  WORKDIR /app
 
9
 
10
  # Copy the requirements file and install dependencies
11
  COPY requirements.txt .
12
+ COPY main.py .
13
+ COPY merged.py .
14
+ COPY app.py .
15
 
16
+ # --- NEW INSTALLATION STEPS FOR ROBUST PYTORCH ---
17
+
18
+ # 1. Upgrade pip for stability
19
  RUN pip install --upgrade pip
20
+
21
+ # 2. Install PyTorch explicitly for CPU (as configured in merged.py)
22
+ # This uses the specific CPU index URL, which is the most reliable way
23
+ # to ensure the CPU version of PyTorch is installed without relying on
24
+ # complex dependencies that might not be on the base image.
25
+ RUN pip install torch --index-url https://download.pytorch.org/whl/cpu
26
+
27
+ # 3. Install the rest of the dependencies
28
+ # The original requirements.txt (excluding torch)
29
  RUN pip install -r requirements.txt
30
 
31
+ # --- END NEW INSTALLATION STEPS ---
 
 
 
 
32
 
33
  # Command to run the Streamlit application
 
 
34
  CMD ["streamlit", "run", "app.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
requirements.txt CHANGED
@@ -1,6 +1,9 @@
1
  torch
2
  transformers
3
  streamlit
4
- fpdf
5
  langchain-core
6
- langchain-huggingface
 
 
 
 
1
  torch
2
  transformers
3
  streamlit
4
+ fpdf2
5
  langchain-core
6
+ langchain-huggingface
7
+ huggingface-hub
8
+ pyyaml
9
+ regex