[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80582":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},80582,"Bonsai-Image-Demo","PrismML-Eng\u002FBonsai-Image-Demo","PrismML-Eng","Generate images locally",null,"PowerShell",430,55,5,4,0,23,53,303,69,5.24,false,"main",true,[],"2026-06-12 02:04:04","# Bonsai Image Demo\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\".\u002Fassets\u002Fbonsai-logo.svg\" width=\"280\" alt=\"Bonsai Image\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fprismml.com\">\u003Cb>Website\u003C\u002Fb>\u003C\u002Fa> &nbsp;|&nbsp;\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FPrismML-Eng\u002FBonsai-Image-Demo\">\u003Cb>GitHub\u003C\u002Fb>\u003C\u002Fa> &nbsp;|&nbsp;\n  \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002Fprismml\">\u003Cb>Discord\u003C\u002Fb>\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cb>HF Collections:\u003C\u002Fb>\n  \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Fprism-ml\u002Fbonsai-image\">Bonsai-Image\u003C\u002Fa>\n  &nbsp;|&nbsp;\n  \u003Cb>Whitepapers:\u003C\u002Fb>\n  \u003Ca href=\"bonsai-image-4b-whitepaper.pdf\">Bonsai-Image 4B\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cb>Other Demos:\u003C\u002Fb>\n  \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fprism-ml\u002FBonsai-image-demo\">HuggingFace Space\u003C\u002Fa> ·\n  \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FPrismML-Eng\u002FBonsai-image-demo\u002Fblob\u002Fmain\u002Fnotebooks\u002Fbonsai_image_colab.ipynb\">Google Colab\u003C\u002Fa>\n\u003C\u002Fp>\n\n---\n\nGenerate images with Bonsai on Apple Silicon (macOS via [mflux](https:\u002F\u002Fgithub.com\u002Ffilipstrand\u002Fmflux) + MLX), NVIDIA GPU (Linux via [gemlite](https:\u002F\u002Fgithub.com\u002Fdropbox\u002Fgemlite) + [HQQ](https:\u002F\u002Fgithub.com\u002Fdropbox\u002Fhqq) kernels in `backend_gpu`), or NVIDIA GPU on **Windows natively** (same gemlite\u002FHQQ stack via [triton-windows](https:\u002F\u002Fgithub.com\u002Ftriton-lang\u002Ftriton-windows), no WSL2 needed).\n\n## Quick start\n\n**macOS \u002F Linux:**\n\n```bash\n.\u002Fsetup.sh\n.\u002Fscripts\u002Fgenerate.sh --prompt \"An icy Bonsai tree, in a rainy forest with a snowy mountains in the background, photo realistic.\"\n```\n\n**Windows (PowerShell):**\n\n```powershell\nSet-ExecutionPolicy -Scope CurrentUser RemoteSigned   # one-time; PowerShell blocks .ps1 files by default\n.\\setup.ps1\n.\\scripts\\generate.ps1 -p \"An icy Bonsai tree, in a rainy forest with a snowy mountains in the background, photo realistic.\"\n```\n\nIf something doesn't work on Windows, see [scripts\u002Fwindows.md](scripts\u002Fwindows.md) for prereqs and the FAQ of known failure modes (execution policy, missing git, old NVIDIA driver, vcredist, ports in use, OOM at 1024x1024, etc).\n\n## Download models\n\n```bash\n.\u002Fscripts\u002Fdownload_model.sh                # ternary (default), picks mlx on macOS, gemlite on Linux\n.\u002Fscripts\u002Fdownload_model.sh ternary        # same — explicit\n.\u002Fscripts\u002Fdownload_model.sh binary         # binary 1-bit, platform-aware\n.\u002Fscripts\u002Fdownload_model.sh --model binary-gemlite   # full form, override the backend choice\n```\n\nTernary (1.58-bit) is the recommended demo variant — better quality at a modest size increase. Binary (1-bit) is the smaller \u002F lighter sibling.\n\n## Configuration\n\n| Variable | Values | Default |\n|----------|--------|---------|\n| `BONSAI_VARIANT` | `ternary` (1.58-bit) \u002F `binary` (1-bit) | `ternary` |\n| `BONSAI_PACKAGE_MIN_AGE_DAYS` | int | `7` |\n\n`BONSAI_VARIANT` is honored by both `setup.sh` (picks which weights to download) and `serve.sh` (picks which model the studio loads). Set it once per session: `BONSAI_VARIANT=binary .\u002Fsetup.sh` then `BONSAI_VARIANT=binary .\u002Fscripts\u002Fserve.sh`.\n\nBy default, `setup.sh` and `serve.sh` refuse to install any Python or npm\npackage version that was published less than `BONSAI_PACKAGE_MIN_AGE_DAYS=7`\ndays ago, via `uv sync --exclude-newer` and `npm install --before`. This is\na defense against fresh supply-chain compromises that haven't been caught and fixed by the time\nyou run `setup.sh`. Set `BONSAI_PACKAGE_MIN_AGE_DAYS=0` to disable.\n\n## Running the full studio (backend + frontend)\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\".\u002Fassets\u002Fapp_screenshot.png\" width=\"720\" alt=\"Bonsai Image Studio screenshot\">\n\u003C\u002Fp>\n\n`scripts\u002Fserve.sh` brings up prism-image-studio's FastAPI backend on `:8000`\n(pointed at this repo's `models\u002F`) and the Next.js frontend on `:3000`,\nboth in the foreground. Ctrl+C tears them down together.\n\n```bash\n# default: ternary, ports 8000\u002F3000\n.\u002Fscripts\u002Fserve.sh                       \n\n# custom \nBACKEND_PORT=8800 FRONTEND_PORT=3100 .\u002Fscripts\u002Fserve.sh\n```\n\nThe frontend lives in `vendor\u002Fimage-studio` (cloned by `setup.sh`; override\npath via `STUDIO_DIR=...`). First run installs `frontend\u002Fnode_modules`\nautomatically.\n\n## Generating images (CLI)\n\n> **Recommended path**: run `.\u002Fscripts\u002Fserve.sh` once and use either the\n> studio UI in your browser or `.\u002Fscripts\u002Fsend_request.sh -p \"…\"` from the\n> terminal. Both talk to the running backend.\n>\n> `.\u002Fscripts\u002Fgenerate.sh` is a fallback for when you genuinely need a\n> one-shot run without a running serve.sh. It pays the\n> cold-start cost (imports + model load + first-shape JIT) every time.\n\n### `send_request.sh` - HTTP client to talk to a running studio\n\nSame flag surface as `generate.sh`, but each call POSTs to the studio's\n`\u002Fgenerate` so weights and kernels stay warm across renders:\n\n```bash\n.\u002Fscripts\u002Fsend_request.sh -p \"An icy bonsai tree, in a rainy forest with a snowy mountain in the background, photo realistic.\" --size 1248x832 --seed 9909\nBACKEND_PORT=8800 .\u002Fscripts\u002Fsend_request.sh -p \"...\"     # custom server\n```\n\n### `generate.sh` — one-shot, no server\n\nIn-process wrapper around `scripts\u002Fgenerate.py`, drives\n[`prism-image-studio`](vendor\u002Fimage-studio)'s `FluxPipeline` against the\nlocal `models\u002F` tree:\n\n```bash\n.\u002Fscripts\u002Fgenerate.sh -p \"An icy bonsai tree, in a rainy forest with a snowy mountain in the background, photo realistic.\" --size 1248x832 --seed 9909 --output outputs\u002Ficy_bonsai.png --open\n```\n\nDefault is 512×512 (fast preview). Dimensions have to be multiples of 32. Suggested sizes are:\n\n| Aspect            | Fast (~0.25MP) | Quality (~1MP) |\n|-------------------|----------------|----------------|\n| Square (1:1)      | 512×512        | 1024×1024      |\n| Landscape (3:2)   | 624×416        | 1248×832       |\n| Portrait (2:3)    | 416×624        | 832×1248       |\n| Wide (2:1)        | 704×352        | 1408×704       |\n| Tall (1:2)        | 352×704        | 704×1408       |\n\n\n## Folder structure after setup\n\n```\nBonsai-image-demo\u002F\n  .venv\u002F\n  vendor\u002F                              # private deps cloned by setup.sh\u002F.ps1\n    image-studio\u002F                      # FastAPI backend + Next.js frontend\n    mflux-prism\u002F                       # mflux fork with prism patches\n  models\u002F\n    bonsai-image-4B-ternary-mlx\u002F       # macOS only (default)\n    bonsai-image-4B-ternary-gemlite\u002F   # Linux \u002F Windows (default)\n    bonsai-image-4B-binary-mlx\u002F        # macOS only   (optional, smaller 1-bit)\n    bonsai-image-4B-binary-gemlite\u002F    # Linux \u002F Windows (optional, smaller 1-bit)\n  outputs\u002F\n  .serve-logs\u002F                         # logs from serve.sh \u002F serve.ps1\n  setup.sh                             # macOS + Linux entry point\n  setup.ps1                            # Windows entry point (parallel to setup.sh)\n  scripts\u002F\n    common.sh                          # shared bash helpers\n    common.ps1                         # shared PowerShell helpers\n    download_model.sh \u002F .ps1\n    serve.sh        \u002F .ps1               # primary: backend + frontend studio\n    send_request.sh \u002F .ps1               # HTTP client to a running serve\n    generate.sh     \u002F .ps1               # one-shot CLI (cold-start every call)\n    generate.py                          # Python entry behind generate.{sh,ps1}\n```\n","Bonsai Image Demo 是一个用于生成高质量图像的项目，支持在多种硬件平台上运行。它利用了Apple Silicon、NVIDIA GPU以及Windows原生环境下的gemlite\u002FHQQ堆栈来实现图像生成，无需依赖WSL2等额外组件。核心功能包括通过简单的命令行操作即可根据给定提示生成逼真的图片，并提供了二进制与三元两种模型选择以适应不同需求和性能考量。适用于需要快速创建视觉内容的设计人员、研究人员或是对AI艺术创作感兴趣的个人。",2,"2026-06-11 04:01:17","CREATED_QUERY"]