Add a Hugging Face Spaces pre-requirements file to force a newer pip before installing app dependencies, and switch PyTorch model loading to download SuperAnimal weights into a writable local directory instead of the read-only site-packages model cache. The requirements update also pins Spaces to CPU-only PyTorch wheels to avoid pulling unnecessary CUDA packages.
Lock Gradio to the 6.29 release in both dependency manifests to keep installs consistent across environments, including Hugging Face Spaces. Also expand `.gitignore` for local virtualenv, tool caches, Gradio runtime data, downloaded prediction artifacts, and first-run DLC model downloads so generated files do not get committed.
Merge remote-tracking branch 'upstream/main' into cy/dlc-theme
Normalize all exported prediction JSON to original input-image coordinates for both legacy TF and PyTorch pipelines, including image size metadata and nulls for hidden keypoints. This also threads the source and annotated image sizes through the app, updates the Gradio SDK version, and removes the extra README demo examples.
Refresh the Gradio app with a DeepLabCut-themed UI, configurable keypoint colormaps and bounding-box colors, and a standalone HTML confidence legend instead of drawing it into the output image. This also improves example defaults for different image sizes, cleans up displayed bodypart names, and makes bbox labels more readable with contrast-aware text.
Introduce a `pyproject.toml` with project metadata, runtime dependencies, and Ruff/pyproject-fmt settings, and add a matching `.pre-commit-config.yaml` to enforce basic file checks, pyproject validation, and formatting/linting. Also normalize `.gitignore` with a trailing newline.
Extend the app and UI to surface keypoint confidence more clearly. This adds optional confidence-based coloring with a legend, an annotated image download, and a confidence table sorted by lowest scores first. It also preloads the default SuperAnimal PyTorch model in a background thread so the first request is less likely to block on model download.
Remove unused matplotlib.cm.get_cmap call (removed in matplotlib 3.11) (#13)β
Switch the UI from `gr.Interface` to a `gr.Blocks` layout with an explicit Run button, lazy-cached examples, and serialized queueing to avoid startup/download issues and PyTorch concurrency problems. The MegaDetector selector is now shown only for non-PyTorch backends, display settings are grouped under an accordion, and the bundled examples were cleaned up and expanded.
Introduce a PyTorch inference path for SuperAnimal models, including backend selection in the UI, cached pose/detector runners, and JSON export of predictions. The legacy TensorFlow flow now maps model names separately from local directories, and MegaDetector device selection was corrected for yolov5 loading. The DeepLabCut dependency is also pinned to 3.0.2 to match the new backend integration.
Carry the filtered MegaDetector bounding boxes through cropping, visualization, and JSON export so pose results stay matched to the correct animal detections. This also removes the obsolete save_results module and hardens DLC inference by handling empty crop lists, converting crop channel order for DLCLive, and masking low-confidence keypoints with NaN.
Skip torch.hub GitHub API validation (fixes #10) (#12)β