{"id":30641160,"url":"https://github.com/marshallvoid/sigil-solver","last_synced_at":"2025-08-31T01:39:35.957Z","repository":{"id":310793589,"uuid":"981893360","full_name":"marshallvoid/sigil-solver","owner":"marshallvoid","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-20T08:31:56.000Z","size":73988,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T09:31:53.197Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sigil-solver.vercel.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marshallvoid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-12T04:13:26.000Z","updated_at":"2025-08-20T08:31:59.000Z","dependencies_parsed_at":"2025-08-20T09:42:04.291Z","dependency_job_id":null,"html_url":"https://github.com/marshallvoid/sigil-solver","commit_stats":null,"previous_names":["marshallvoid/sigil-solver"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/marshallvoid/sigil-solver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marshallvoid%2Fsigil-solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marshallvoid%2Fsigil-solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marshallvoid%2Fsigil-solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marshallvoid%2Fsigil-solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marshallvoid","download_url":"https://codeload.github.com/marshallvoid/sigil-solver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marshallvoid%2Fsigil-solver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272930000,"owners_count":25017057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-31T01:39:35.464Z","updated_at":"2025-08-31T01:39:35.949Z","avatar_url":"https://github.com/marshallvoid.png","language":"Python","readme":"## Sigil Solver\n\nHigh-performance slide-captcha solver powered by FastAPI, Ultralytics YOLO, ONNX Runtime, and PyTorch.\n\n### Features\n\n-  Robust FastAPI service with DI via Dishka\n-  Single endpoint to solve slide-style captchas\n-  GPU acceleration on Linux/Windows (CUDA) when available; optimized CPU paths otherwise\n-  Production-friendly logging and error handling\n-  OpenAPI/Scalar docs included\n\n### Requirements\n\n-  Python 3.10–3.11\n-  macOS, Linux, or Windows\n-  Optional: NVIDIA GPU + CUDA drivers for acceleration on Linux/Windows\n\n### Quickstart\n\n1. Clone the repository\n\n```bash\ngit clone \u003crepository-url\u003e\ncd sigil-solver\n```\n\n2. Create a virtual environment and install dependencies (recommended: uv)\n\n```bash\npipx install uv || pip install uv\nuv venv\nsource .venv/bin/activate  # Windows: .venv\\\\Scripts\\\\activate\nuv sync\n```\n\n3. Run the API\n\n-  Fastest way (ASGI):\n\n```bash\nuv run uvicorn sigil.main.api.native:app --host 0.0.0.0 --port 8000\n```\n\n-  Alternatively (CLI wrapper):\n\n```bash\nuv run python -c \"from sigil.main.cli.app import run_cli; run_cli()\" api --host 0.0.0.0 --port 8000\n```\n\n4. Explore docs\n\n-  Scalar UI: http://localhost:8000/scalar\n-  OpenAPI JSON: http://localhost:8000/docs\n\n### Configuration\n\nThe app uses `pydantic-settings` with the `SIGIL_` prefix. You can set variables in your environment or a `.env` file at the project root.\n\nAvailable keys (nested config uses double underscores):\n\n-  `SIGIL_SECRET_KEY`: Secret key (default: `secret_key`)\n-  `SIGIL_DEBUG`: `true`/`false` to enable debug mode (default: `false`)\n-  `SIGIL_OPENAI__API_KEY`: Optional OpenAI API key\n-  `SIGIL_OPENAI__MODEL`: Optional OpenAI model (default: `o3`)\n-  `SIGIL_ANTHROPIC__API_KEY`: Optional Anthropic API key\n-  `SIGIL_ANTHROPIC__MODEL`: Optional Anthropic model (default: `claude-opus-4-1-20250805`)\n\nExample `.env`:\n\n```env\nSIGIL_DEBUG=true\nSIGIL_SECRET_KEY=change_me\nSIGIL_OPENAI__API_KEY=sk-xxxxx\nSIGIL_ANTHROPIC__API_KEY=anthropic-xxxxx\n```\n\n### API Overview\n\nBase URL: `http://localhost:8000`\n\n-  GET `/` → Service status\n\n   -  Response: `{ \"success\": true, \"msg\": \"running\" }`\n\n-  GET `/health` → Health check\n\n   -  Response: `{ \"status\": \"ok\" }`\n\n-  GET `/scalar` → Interactive API docs (Scalar UI)\n\n-  POST `/api/v1/captchas/slide` → Solve slide captcha\n   -  Request body fields (JSON):\n      -  `puzzle_image_b64`: Base64 data URI or raw base64 string of the puzzle image (optional)\n      -  `puzzle_image_url`: URL to the puzzle image (optional)\n      -  `piece_image_b64`: (reserved) Base64 of the slider piece (optional)\n      -  `piece_image_url`: (reserved) URL of the slider piece (optional)\n      -  `shrink_size`: Optional shrink size (default: `340.0`)\n   -  Exactly one of `puzzle_image_b64` or `puzzle_image_url` is required.\n   -  Response body:\n      -  `status`: `successful` or `failed`\n      -  `x`: float, the estimated x-offset where the piece should slide\n\n#### cURL examples\n\nUsing an image URL:\n\n```bash\ncurl -X POST http://localhost:8000/api/v1/captchas/slide \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n        \"puzzle_image_url\": \"https://example.com/captcha.jpg\"\n      }'\n```\n\nUsing base64 (data URI or raw base64):\n\n```bash\nBASE64=$(base64 -w 0 path/to/captcha.jpg)  # macOS: base64 path/to/captcha.jpg | tr -d '\\n'\ncurl -X POST http://localhost:8000/api/v1/captchas/slide \\\n  -H 'Content-Type: application/json' \\\n  -d \"{ \\\"puzzle_image_b64\\\": \\\"$BASE64\\\" }\"\n```\n\nExample response:\n\n```json\n{\n   \"data\": {\n      \"status\": \"successful\",\n      \"x\": 132.4\n   },\n   \"meta\": {}\n}\n```\n\n### How it works\n\n-  `sigil.services.recognizer.RecognizerService` loads two ONNX YOLO models from `sigil/models/yolo/`.\n-  The service predicts the likely gap location and returns an x-offset.\n-  CUDA is used automatically if available; otherwise, it falls back to CPU.\n\n### Development\n\nRun the server in reload mode:\n\n```bash\nuv run uvicorn sigil.main.api.native:app --reload --host 0.0.0.0 --port 8000\n```\n\nCode style and tooling:\n\n-  Formatter: black, isort\n-  Lint: ruff, flake8, mypy\n-  Pre-commit hooks are available in the dev group\n\n### Troubleshooting\n\n-  Torch/ONNX install issues:\n   -  macOS arm64 uses `onnxruntime-silicon` automatically; ensure Python 3.10–3.11.\n   -  Linux/Windows with NVIDIA GPU: ensure CUDA toolkits/drivers compatible with PyTorch 2.2.2.\n-  Large model memory usage:\n   -  Set `ENVIRONMENT=production` to avoid verbose stderr inferences.\n   -  Reduce `imgsz` or confidence thresholds in `RecognizerService._predict` if customizing.\n-  HTTP 400 when downloading images:\n   -  Ensure the URL is reachable and returns an `image/*` content type.\n\n### License\n\nThis project is licensed under the terms of the MIT License. See `LICENSE` for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshallvoid%2Fsigil-solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarshallvoid%2Fsigil-solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshallvoid%2Fsigil-solver/lists"}