Spaces:
Sleeping
Sleeping
Commit ·
fafbe63
1
Parent(s): 7c0ff97
Switch to uv and docker
Browse files- .python-version +1 -0
- Dockerfile +37 -0
- pyproject.toml +16 -0
- requirements.txt +1 -1
- uv.lock +0 -0
.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.12
|
Dockerfile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.12
|
| 2 |
+
FROM python:3.12-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies required to compile detectron2
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
git \
|
| 7 |
+
build-essential \
|
| 8 |
+
cmake \
|
| 9 |
+
libgl1-mesa-glx \
|
| 10 |
+
libglib2.0-0 \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Install uv (The recommended manager for your stack)
|
| 14 |
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
| 15 |
+
|
| 16 |
+
WORKDIR /app
|
| 17 |
+
|
| 18 |
+
# Copy dependency files
|
| 19 |
+
COPY pyproject.toml uv.lock ./
|
| 20 |
+
|
| 21 |
+
# Install core dependencies first
|
| 22 |
+
# We force install torch separately to ensure it is present for detectron2's build
|
| 23 |
+
RUN uv sync --frozen --no-dev
|
| 24 |
+
|
| 25 |
+
# Install detectron2
|
| 26 |
+
# Note: --no-build-isolation is often required for detectron2 to find
|
| 27 |
+
# the torch installed by uv
|
| 28 |
+
# RUN .venv/bin/pip install 'git+https://github.com/facebookresearch/detectron2.git' --no-build-isolation
|
| 29 |
+
|
| 30 |
+
# Copy the rest of your application code
|
| 31 |
+
COPY . .
|
| 32 |
+
|
| 33 |
+
# Set environment
|
| 34 |
+
ENV PATH="/app/.venv/bin:$PATH"
|
| 35 |
+
|
| 36 |
+
# Run the application
|
| 37 |
+
CMD ["python", "app.py"]
|
pyproject.toml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "microvision-model"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "MicroVision model gradio space"
|
| 5 |
+
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.12"
|
| 7 |
+
dependencies = [
|
| 8 |
+
"gradio>=6.14.0",
|
| 9 |
+
"pillow>=12.2.0",
|
| 10 |
+
"rfdetr>=1.6.5.post2",
|
| 11 |
+
"supervision>=0.27.0.post2",
|
| 12 |
+
"ultralytics>=8.4.52",
|
| 13 |
+
"torch>=2.0.0",
|
| 14 |
+
"torchvision>=0.15.0",
|
| 15 |
+
"detectron2 @ git+https://github.com/facebookresearch/detectron2.git"
|
| 16 |
+
]
|
requirements.txt
CHANGED
|
@@ -14,7 +14,7 @@ colorama==0.4.6
|
|
| 14 |
contourpy==1.3.3
|
| 15 |
cycler==0.12.1
|
| 16 |
defusedxml==0.7.1
|
| 17 |
-
detectron2 @ git+https://github.com/facebookresearch/detectron2.git
|
| 18 |
fastapi==0.136.1
|
| 19 |
filelock==3.29.0
|
| 20 |
fonttools==4.63.0
|
|
|
|
| 14 |
contourpy==1.3.3
|
| 15 |
cycler==0.12.1
|
| 16 |
defusedxml==0.7.1
|
| 17 |
+
detectron2 @ git+https://github.com/facebookresearch/detectron2.git
|
| 18 |
fastapi==0.136.1
|
| 19 |
filelock==3.29.0
|
| 20 |
fonttools==4.63.0
|
uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|