Alp İpekçiler commited on
Commit
9afe470
·
1 Parent(s): b555b7e

Fix config error and optimize Docker setup with ConvNextV2 model

Browse files
Files changed (3) hide show
  1. .spacesconfig.yaml +2 -0
  2. Dockerfile +14 -3
  3. requirements.txt +7 -8
.spacesconfig.yaml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ sdk: docker
2
+ app_port: 7860
Dockerfile CHANGED
@@ -1,11 +1,22 @@
1
- FROM python:3.9
2
 
3
  WORKDIR /code
4
 
 
 
 
 
 
 
5
  COPY ./requirements.txt /code/requirements.txt
 
 
6
 
7
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
8
 
9
- COPY ./app.py /code/
 
10
 
 
11
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.9-slim
2
 
3
  WORKDIR /code
4
 
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy requirements and install Python dependencies
11
  COPY ./requirements.txt /code/requirements.txt
12
+ RUN pip install --no-cache-dir --upgrade pip && \
13
+ pip install --no-cache-dir -r /code/requirements.txt
14
 
15
+ # Copy application code
16
+ COPY ./app.py /code/app.py
17
 
18
+ # Expose port
19
+ EXPOSE 7860
20
 
21
+ # Run the application
22
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
@@ -1,8 +1,7 @@
1
- fastapi
2
- uvicorn[standard]
3
- python-multipart
4
- pillow
5
- torch
6
- torchvision
7
- transformers
8
- numpy
 
1
+ fastapi==0.104.1
2
+ uvicorn[standard]==0.24.0
3
+ python-multipart==0.0.6
4
+ pillow==10.1.0
5
+ torch==2.1.0
6
+ transformers==4.35.0
7
+ numpy==1.24.3