Spaces:
Sleeping
Sleeping
|
Download README.md from neonforestmist/AutoSprite: direct link, hf CLI and curl.
- Browser
- Download file 2.11 kB
-
https://huggingface.co/spaces/neonforestmist/AutoSprite/resolve/main/README.md
- Command line
-
hf download hf://spaces/neonforestmist/AutoSprite/README.md
-
curl -L -o README.md https://huggingface.co/spaces/neonforestmist/AutoSprite/resolve/main/README.md
2.11 kB
| title: AutoSprite | |
| emoji: 👾 | |
| colorFrom: indigo | |
| colorTo: pink | |
| sdk: gradio | |
| sdk_version: 6.32.0 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| short_description: Few pixel-art frames in, full spritesheet out (CPU) | |
| # AutoSprite | |
| Upload as few as one consistent pixel-art frame (16x16 or 18x18 work best, up to 24x24) and | |
| AutoSprite fills in the rest of a platformer set — `idle`, `walk_1..3`, `jump` — then packs a | |
| downloadable spritesheet, atlas JSON, per-frame PNGs and a walk-cycle GIF. | |
| ## How it works | |
| - **Model:** a 3.5M-parameter U-Net (`autosprite/model.py`) that sees whichever poses you gave | |
| and predicts the missing ones. Its output head is a *palette pointer*: each pixel picks one of | |
| the colors already in your frames (or transparency), so results stay crisp and on-palette. | |
| - **Data:** no scraped sprites. `autosprite/synth.py` procedurally generates unlimited side-view | |
| characters (random proportions, palettes, hair, hats, shading, outlines, walk styles) rendered | |
| consistently in all five poses. Training hides random poses and learns to reconstruct them. | |
| - **Runtime:** exported to ONNX and run with `onnxruntime` on CPU — about a hundred | |
| milliseconds per sheet, no GPU required. | |
| - **Input cleanup:** upscaled art (e.g. 320x320 of an 18x18 sprite) is detected and resampled | |
| back to its native grid with nearest-neighbor, flat backgrounds are removed, and near-duplicate | |
| shades are merged. | |
| ## Run locally | |
| ```bash | |
| pip install -r requirements.txt gradio | |
| python app.py | |
| ``` | |
| ## Train your own | |
| ```bash | |
| pip install torch onnx | |
| python train.py --steps 16000 --out weights/autosprite.pt | |
| python export_onnx.py weights/autosprite.pt weights/autosprite.onnx | |
| python evaluate.py examples/alan --out eval_alan.png | |
| ``` | |
| Training uses Apple `mps`, CUDA, or CPU automatically. | |
| ## Limits | |
| - One side-view platformer pose set; sprites larger than 24x24 (e.g. big Mario at 16x32) are not | |
| supported yet. | |
| - The model has only ever seen procedural characters, so very stylized art (3/4 views, | |
| big silhouette changes between frames) gets approximate frames that are worth touching up. | |