AIcoder35235 commited on
Commit
03e9c25
·
verified ·
1 Parent(s): 656c3ce

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -11
Dockerfile CHANGED
@@ -1,21 +1,22 @@
1
- # 1. Use a lightweight Python base
2
  FROM python:3.11-slim
3
 
4
  # 2. Set the working directory
5
  WORKDIR /app
6
 
7
- # 3. Install PyTorch (CPU version)
8
- RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
 
9
 
10
- # 4. Install API dependencies
11
- RUN pip install --no-cache-dir fastapi uvicorn transformers pillow pydantic requests
 
12
 
13
- # 5. THE CHEAT CODE: Pre-download the Deepfake weights
14
- # Change this line in your Dockerfile
15
- # Change this line in your Dockerfile
16
- RUN python -c "from transformers import pipeline; pipeline('image-classification', model='prithivMLmods/deepfake-detector-model-v1')"
17
- # 7. Expose port
18
  EXPOSE 7860
19
 
20
- # 8. Start the node
21
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # 1. Base Image
2
  FROM python:3.11-slim
3
 
4
  # 2. Set the working directory
5
  WORKDIR /app
6
 
7
+ # 3. Install dependencies (Pre-downloading the NEW model we discussed)
8
+ RUN pip install --no-cache-dir fastapi uvicorn transformers pillow pydantic requests torch torchvision --index-url https://download.pytorch.org/whl/cpu
9
+ RUN python -c "from transformers import pipeline; pipeline('image-classification', model='prithivMLmods/deepfake-detector-model-v1')"
10
 
11
+ # 4. Copy your app.py specifically into the current WORKDIR (/app)
12
+ # This ensures uvicorn can find the "app" module
13
+ COPY app.py /app/app.py
14
 
15
+ # 5. Set environment variable to make sure Python finds the /app folder
16
+ ENV PYTHONPATH=/app
17
+
18
+ # 6. Expose port
 
19
  EXPOSE 7860
20
 
21
+ # 7. Start the node - using the full path to be safe
22
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]