Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ RUN cd /app/packages/python && \
# Copy backend application code
COPY apps/web/backend/ ./backend/

# Copy ONNX model checkpoints
COPY models/checkpoints/ ./checkpoints/
# Download ONNX model checkpoints from Hugging Face
RUN mkdir -p /app/checkpoints && \
curl -fL --retry 3 -o /app/checkpoints/depth_anything_v2_vits_slim.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/depth_anything_v2_vits_slim.onnx" && \
curl -fL --retry 3 -o /app/checkpoints/isnet.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/isnet.onnx" && \
curl -fL --retry 3 -o /app/checkpoints/focus_matting_1.0.0.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/focus_matting_1.0.0.onnx" && \
curl -fL --retry 3 -o /app/checkpoints/focus_refiner_1.0.0.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/focus_refiner_1.0.0.onnx"

# Copy built frontend from frontend builder to static directory
COPY --from=frontend-builder /app/dist ./static
Expand Down
13 changes: 11 additions & 2 deletions apps/web/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ FROM python:3.12-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgomp1 \
curl \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
Expand All @@ -41,8 +42,16 @@ ENV PATH="/app/apps/web/backend/.venv/bin:/app/packages/python/.venv/bin:$PATH"
# Copy application code
COPY apps/web/backend/ ./backend/

# Copy ONNX model checkpoints
COPY models/checkpoints/ ./checkpoints/
# Download ONNX model checkpoints from Hugging Face
RUN mkdir -p /app/checkpoints && \
curl -fL --retry 3 -o /app/checkpoints/depth_anything_v2_vits_slim.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/depth_anything_v2_vits_slim.onnx" && \
curl -fL --retry 3 -o /app/checkpoints/isnet.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/isnet.onnx" && \
curl -fL --retry 3 -o /app/checkpoints/focus_matting_1.0.0.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/focus_matting_1.0.0.onnx" && \
curl -fL --retry 3 -o /app/checkpoints/focus_refiner_1.0.0.onnx \
"https://huggingface.co/withoutbg/focus/resolve/main/focus_refiner_1.0.0.onnx"

# Set environment variables
ENV PYTHONUNBUFFERED=1
Expand Down
1 change: 0 additions & 1 deletion apps/web/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ services:
# Mount source code for hot-reload (correct path for Python 3.12 venv)
- ../../packages/python/src/withoutbg:/app/apps/web/backend/.venv/lib/python3.12/site-packages/withoutbg:ro
- ./backend:/app/backend:ro
- ../../models/checkpoints:/app/checkpoints:ro
working_dir: /app
command: [ "/app/apps/web/backend/.venv/bin/python", "-m", "uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload" ]
networks:
Expand Down
5 changes: 5 additions & 0 deletions packages/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ select = [

[tool.mypy]
python_version = "3.9"
exclude = ["^\\.venv/"]
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
Expand All @@ -120,6 +121,10 @@ warn_no_return = true
warn_unreachable = true
strict_equality = true

[[tool.mypy.overrides]]
module = ["huggingface_hub.*"]
follow_imports = "skip"

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
Expand Down
Loading