Skip to content

kandotrun/kururi-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kururi AI CLI

DeepWiki

Image rotation classifier with a ViT model. The CLI runs on CPU, CUDA, or Apple MPS, auto-downloads the checkpoint from a GitHub Release, and supports single-file or recursive directory processing.

Features

  • Auto checkpoint download on first run (URL/sha256 configurable via args or env).
  • Single image prediction or recursive directory batch processing.
  • Optional saving of rotation-corrected images.
  • Pure-Python CLI (no comments, typed, minimal dependencies).

Requirements

  • Python 3.12.9
  • PyTorch, TorchVision, timm, Pillow (installed via uv pip install -e cli)

Setup

git clone https://github.com/kandotrun/kururi-ai.git
cd kururi-ai
uv venv .venv
source .venv/bin/activate
uv pip install -e cli

Model download

  • If models/kururi-orient-v1.pth is missing, the CLI downloads it from the configured URL.
  • Set URL and hash via args or environment variables:
export KURURI_MODEL_URL="https://github.com/<owner>/<repo>/releases/download/v0.1.0/kururi-orient-v1.pth"
export KURURI_MODEL_SHA256="<sha256sum>"
# optional
export KURURI_MODEL_TIMEOUT=1800
  • Default URL is a placeholder: https://github.com/OWNER/REPO/releases/download/v0.1.0/kururi-orient-v1.pth. Replace it after publishing your Release.

Usage

Single image:

uv run python cli/main.py predict \
  --image /path/to/image.jpg \
  --device cpu \
  --model-name vit_large_patch16_224 \
  --save-rotated /path/to/fixed.jpg

Recursive directory:

uv run python cli/main.py predict \
  --dir /path/to/images \
  --save-rotated-dir outputs \
  --device cpu \
  --model-name vit_large_patch16_224

Supported extensions: jpg, jpeg, png, bmp, tif, tiff, webp.

Try with bundled samples (recursive):

uv run python cli/main.py predict \
  --dir samples \
  --save-rotated-dir samples_out \
  --device cpu

Sample inputs and corrected outputs (thumbnails):

# Input Corrected output
1 sample1 input sample1 output
2 sample2 input sample2 output
3 sample3 input sample3 output
4 sample4 input sample4 output
5 sample5 input sample5 output

Checkpoint options

  • --checkpoint path (default models/kururi-orient-v1.pth)
  • --checkpoint-url override download URL
  • --checkpoint-sha256 integrity check
  • --download-timeout seconds (default 1800 or KURURI_MODEL_TIMEOUT)

Publish the model to GitHub Release

  1. Compute hash: shasum -a 256 models/kururi-orient-v1.pth
  2. Create a Release and upload kururi-orient-v1.pth as an asset.
  3. Update README, env examples, and default URL in code/CI with the Release URL and sha256.

License

Japanese documentation

See README.ja.md for the Japanese version.

About

Kururi AI CLI

Resources

License

Stars

Watchers

Forks

Contributors

Languages