ButterM40 commited on
Commit
9bb8348
·
1 Parent(s): 7eb6066

Restore full ML server (Space is working, just need real models)

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -4
Dockerfile CHANGED
@@ -6,19 +6,31 @@ WORKDIR /code
6
 
7
  # Set environment variables
8
  ENV PORT=7860
 
 
 
 
 
 
 
 
9
 
10
  # Copy requirements first for better caching
11
  COPY requirements.txt .
12
 
13
- # Install only essential packages for now
14
  RUN pip install --no-cache-dir --upgrade pip && \
15
- pip install --no-cache-dir fastapi uvicorn pydantic python-multipart pillow
 
16
 
17
  # Copy the rest of the application
18
  COPY . .
19
 
 
 
 
20
  # Make port 7860 available
21
  EXPOSE 7860
22
 
23
- # Run the FastAPI server
24
- CMD ["uvicorn", "server_minimal:app", "--host", "0.0.0.0", "--port", "7860"]
 
6
 
7
  # Set environment variables
8
  ENV PORT=7860
9
+ ENV TRANSFORMERS_CACHE=/code/.cache/transformers
10
+
11
+ # Install system dependencies
12
+ RUN apt-get update && \
13
+ apt-get install -y --no-install-recommends \
14
+ build-essential \
15
+ git \
16
+ && rm -rf /var/lib/apt/lists/*
17
 
18
  # Copy requirements first for better caching
19
  COPY requirements.txt .
20
 
21
+ # Install dependencies (add back torch and transformers)
22
  RUN pip install --no-cache-dir --upgrade pip && \
23
+ pip install --no-cache-dir torch==2.1.0 transformers==4.46.3 && \
24
+ pip install --no-cache-dir -r requirements.txt
25
 
26
  # Copy the rest of the application
27
  COPY . .
28
 
29
+ # Create cache directory for transformers
30
+ RUN mkdir -p /code/.cache/transformers
31
+
32
  # Make port 7860 available
33
  EXPOSE 7860
34
 
35
+ # Run the main FastAPI server (not minimal)
36
+ CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]