Skip to content

Added an API and docker distribution for building production ready application - #126

Open
Mawwlle wants to merge 22 commits into
yangchris11:masterfrom
Mawwlle:master
Open

Added an API and docker distribution for building production ready application #126
Mawwlle wants to merge 22 commits into
yangchris11:masterfrom
Mawwlle:master

Conversation

@Mawwlle

@Mawwlle Mawwlle commented Mar 12, 2026

Copy link
Copy Markdown

Add production API, web demo, and Docker support

What was done

API

  • Added CORS middleware to allow browser requests
  • Frame extraction moved from upload time to session creation (lazy, cached)
  • MOV support — non-MP4 files are converted to MP4 via ffmpeg on upload
  • Session close now deletes uploaded files and frames from disk
  • Added /videos/upload-frames endpoint for uploading raw frame sequences
  • frame_count added to video metadata via ffprobe nb_frames

Bug fixes

  • Fixed MPS crash during propagation: torch.tensor() was inferring float64 from Python floats in Kalman filter IOU computation (sam2_base.py:472); forced dtype=torch.float32

Infrastructure

  • Added run.sh — handles PYTHONPATH and SAMURAI_APP_ROOT so uvicorn launches correctly without the sam2/ directory shadowing the package
  • Added Dockerfile with CUDA 12.1, ffmpeg, checkpoint download at build time
  • Added docker-compose.yml for single-command GPU deployment on port 7676; Docker-specific paths (SAMURAI_APP_ROOT, SAMURAI_DATA_PATH) set via environment: to override .env
  • Added .env.example

Frontend

  • Added index.html — single-page demo with drag & drop upload, canvas bbox drawing, propagation streaming, mask overlay rendering, and video export with annotations

Docs

  • Updated README.md with native run instructions, Docker/Compose instructions, endpoint reference, and typical workflow

@sourcelocation

Copy link
Copy Markdown

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants