Spaces:
Runtime error
Runtime error
Commit
·
301adae
1
Parent(s):
5162a29
fix
Browse files- Dockerfile +52 -15
- requirements.txt +5 -2
Dockerfile
CHANGED
@@ -1,32 +1,69 @@
|
|
1 |
-
# Build stage
|
2 |
-
FROM python:3.
|
3 |
|
4 |
-
WORKDIR /app
|
5 |
|
6 |
-
RUN apt-get update && apt-get install -y
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
-
# Copy requirements and install other Python dependencies
|
12 |
-
COPY requirements.txt .
|
13 |
|
14 |
-
# Install pre-installed torch first
|
15 |
-
RUN pip install --upgrade pip && \
|
16 |
-
pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
WORKDIR /app
|
22 |
|
23 |
-
RUN apt-get update && apt-get install -y
|
|
|
|
|
|
|
|
|
24 |
|
|
|
|
|
|
|
25 |
|
26 |
-
# Copy files from the builder stage
|
27 |
-
COPY --from=builder /app /app
|
28 |
COPY . .
|
29 |
|
30 |
EXPOSE 8000
|
31 |
|
32 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
1 |
+
# # Build stage
|
2 |
+
# FROM python:3.8.18 AS builder
|
3 |
|
4 |
+
# WORKDIR /app
|
5 |
|
6 |
+
# RUN apt-get update && apt-get install -y \
|
7 |
+
# ffmpeg \
|
8 |
+
# libsm6 \
|
9 |
+
# libxext6 \
|
10 |
+
# && rm -rf /var/lib/apt/lists/*
|
11 |
+
|
12 |
+
# # Copy requirements and install Python dependencies
|
13 |
+
# COPY requirements.txt .
|
14 |
+
|
15 |
+
# RUN pip install --upgrade pip && \
|
16 |
+
# pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
|
17 |
+
|
18 |
+
# # Final stage
|
19 |
+
# FROM python:3.8.18
|
20 |
+
|
21 |
+
# WORKDIR /app
|
22 |
+
|
23 |
+
# RUN apt-get update && apt-get install -y \
|
24 |
+
# ffmpeg \
|
25 |
+
# libsm6 \
|
26 |
+
# libxext6 \
|
27 |
+
# && rm -rf /var/lib/apt/lists/*
|
28 |
+
|
29 |
+
# # Copy files from the builder stage
|
30 |
+
# COPY --from=builder /app /app
|
31 |
+
# COPY . .
|
32 |
+
|
33 |
+
# EXPOSE 8000
|
34 |
+
|
35 |
+
# CMD ["/usr/local/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
36 |
|
37 |
|
38 |
|
39 |
|
|
|
|
|
40 |
|
|
|
|
|
|
|
41 |
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
FROM python:3.8.18
|
51 |
|
52 |
WORKDIR /app
|
53 |
|
54 |
+
RUN apt-get update && apt-get install -y \
|
55 |
+
ffmpeg \
|
56 |
+
libsm6 \
|
57 |
+
libxext6 \
|
58 |
+
&& rm -rf /var/lib/apt/lists/*
|
59 |
|
60 |
+
COPY requirements.txt .
|
61 |
+
RUN pip install --upgrade pip && \
|
62 |
+
pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
|
63 |
|
|
|
|
|
64 |
COPY . .
|
65 |
|
66 |
EXPOSE 8000
|
67 |
|
68 |
+
# CMD ["/usr/local/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
69 |
+
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
requirements.txt
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
fastapi
|
2 |
-
uvicorn[standard]
|
3 |
-
|
|
|
4 |
ultralytics
|
5 |
pillow
|
6 |
python-multipart
|
7 |
numpy
|
|
|
|
|
|
1 |
fastapi
|
2 |
+
# uvicorn[standard]
|
3 |
+
uvicorn==0.32.0
|
4 |
+
# torchvision
|
5 |
ultralytics
|
6 |
pillow
|
7 |
python-multipart
|
8 |
numpy
|
9 |
+
# torch==2.1.2+cpu
|
10 |
+
# torchvision==0.16.2+cpu
|