Your Name commited on
Commit
4de0404
·
1 Parent(s): 133c184

v3.4: Fix build error - switch to tensorflow-cpu

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -2
  2. requirements.txt +1 -1
Dockerfile CHANGED
@@ -1,14 +1,17 @@
1
  FROM python:3.11-slim
2
  WORKDIR /app
3
 
4
- # Standard CV and HDF5 libraries
5
  RUN apt-get update && apt-get install -y \
6
  libhdf5-dev \
7
  libgl1-mesa-glx \
8
  libglib2.0-0 \
 
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  COPY requirements.txt .
 
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
  COPY best_v6.keras .
@@ -17,5 +20,5 @@ COPY portal.html .
17
  COPY main.py .
18
 
19
  EXPOSE 7860
20
- # 1 worker to save RAM on free tier
21
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
1
  FROM python:3.11-slim
2
  WORKDIR /app
3
 
4
+ # Essential system dependencies for TF-CPU, PIL, and OpenCV
5
  RUN apt-get update && apt-get install -y \
6
  libhdf5-dev \
7
  libgl1-mesa-glx \
8
  libglib2.0-0 \
9
+ libsm6 \
10
+ libxext6 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
  COPY requirements.txt .
14
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
  COPY best_v6.keras .
 
20
  COPY main.py .
21
 
22
  EXPOSE 7860
23
+ # Force single worker to avoid RAM spikes on Hugging Face free tier
24
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
requirements.txt CHANGED
@@ -1,7 +1,7 @@
1
  fastapi
2
  uvicorn[standard]
3
  python-multipart
4
- tensorflow==2.16.1
5
  pillow
6
  numpy<2.0.0
7
  python-dotenv
 
1
  fastapi
2
  uvicorn[standard]
3
  python-multipart
4
+ tensorflow-cpu==2.16.1
5
  pillow
6
  numpy<2.0.0
7
  python-dotenv