tannuiscoding commited on
Commit
0ae4642
·
1 Parent(s): 70b54f0

Fix deployment for Hugging Face Spaces using gunicorn

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -22
Dockerfile CHANGED
@@ -1,35 +1,18 @@
1
- # Base image with Python
2
  FROM python:3.10-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
7
-
8
  # Set work directory
9
  WORKDIR /app
10
 
11
- # Install system dependencies
12
- RUN apt-get update && apt-get install -y \
13
- ffmpeg \
14
- libsndfile1 \
15
- libglib2.0-0 \
16
- libsm6 \
17
- libxrender1 \
18
- libxext6 \
19
- && rm -rf /var/lib/apt/lists/*
20
-
21
- # Install Python dependencies
22
  COPY requirements.txt .
23
  RUN pip install --no-cache-dir -r requirements.txt
24
 
25
- # Copy app files
26
  COPY . .
27
 
28
- # Create uploads directory
29
- RUN mkdir -p uploads
30
-
31
  # Expose the port Hugging Face expects
32
  EXPOSE 7860
33
 
34
- # Run the app
35
- CMD ["python", "app.py"]
 
1
+ # Use Python base image
2
  FROM python:3.10-slim
3
 
 
 
 
 
4
  # Set work directory
5
  WORKDIR /app
6
 
7
+ # Install dependencies
 
 
 
 
 
 
 
 
 
 
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
+ # Copy the rest of your code
12
  COPY . .
13
 
 
 
 
14
  # Expose the port Hugging Face expects
15
  EXPOSE 7860
16
 
17
+ # Run your Flask app with gunicorn
18
+ CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]