ChitraDev is a local-first FastAPI image generation app for Stable Diffusion 1.5. It can generate images from prompts alone, or use one or two FaceID reference photos through IP-Adapter FaceID identity guidance. Generated PNGs, ZIP downloads, reference photos, and model cache stay on your own machine.
ChitraDev is built to avoid hosted image-generation limits. There are no subscription quotas, remote credits, or repo-imposed creative category blocks in the app itself. Practical output is controlled by your local hardware, selected model behavior, environment settings, and the laws or consent requirements that apply to your use.
- Prompt-only image generation with Stable Diffusion 1.5.
- Optional single-person FaceID generation with one reference image.
- Optional two-person FaceID generation with separate Person 1 and Person 2 reference images.
- Left/right person placement controls for cleaner two-person identity separation.
- Previewable PNG outputs with direct image downloads and a ZIP download.
- Separate batch creator page for long prompt-only runs.
- Local FastAPI browser UI at
http://127.0.0.1:8000. - Public website lives in the separate
ChitraDevWebrepository.
Recommended local setup:
| Requirement | Recommended | Notes |
|---|---|---|
| OS | Windows 10/11 | PowerShell scripts are included. Linux/macOS can adapt the same Python commands manually. |
| Python | 3.11 | The setup script creates a .venv using Python 3.11. |
| GPU | NVIDIA CUDA GPU | Defaults are tuned for a 4 GB GPU at 512x512, 20 steps, and 1 image. |
| CPU-only | Supported, but slow | CPU generation can work, but expect long generation times. |
| Disk | Several GB free | Stable Diffusion, IP-Adapter, and InsightFace assets cache in .cache/. |
| RAM | 16 GB recommended | More memory helps model loading and larger batches. |
| Node.js | 20 or newer | Needed only for the public website in frontend/. |
| Git | Latest stable | Needed to clone the repo and publish the website. |
| Network | Required on first model load | Use LOCAL_FILES_ONLY=true after assets are already cached locally. |
- Clone ChitraDev and open the folder:
git clone https://github.com/yuvrajraina/ChitraDev.git
cd ChitraDev- Optional: create
.envfrom.env.exampleif you want custom local paths, default generation settings, or higher hardware caps:
Copy-Item .env.example .env- Run the setup script:
powershell -ExecutionPolicy Bypass -File .\scripts\setup.ps1- Activate the environment:
.\.venv\Scripts\Activate.ps1- Optional but recommended: preload the model stack before opening the UI:
powershell -ExecutionPolicy Bypass -File .\scripts\preload_models.ps1- Start ChitraDev:
python -m uvicorn app.main:app --host 127.0.0.1 --port 8000- Open the local app:
http://127.0.0.1:8000
If you see a torchvision::nms does not exist error, rerun the setup script. It force-reinstalls a matching CUDA build of torch, torchvision, and torchaudio.
Prompt-only generation:
- Open
http://127.0.0.1:8000. - Leave both face upload fields empty.
- Put the full subject, style, environment, lighting, and composition in the main prompt.
- Click
Generate images.
Single-person FaceID generation:
- Upload a clear front-facing image in
Person 1 face image. - Add the overall scene in
Prompt. - Optionally describe clothing, pose, or action in
Person 1 role and action. - Click
Generate images.
Two-person FaceID generation:
- Upload
Person 1 face imageandPerson 2 face image. - Describe the overall scene in
Prompt. - Add separate role/action text for each person if needed.
- Use
Interaction or relationshipto describe what they are doing together. - Keep Person 1 and Person 2 on opposite sides in advanced settings.
- Click
Generate images.
Outputs are written to the ignored outputs/ folder and can be downloaded from the browser UI.
Batch generation:
- Open
http://127.0.0.1:8000/batch. - Paste one prompt that should be reused.
- Set total outputs, chunk size, dimensions, steps, guidance, negative prompt, and optional start seed.
- Click
Start batch.
Batch jobs run in the background while the server stays open. Each job writes PNGs, batch-prompt.txt, and batch-results.zip into an ignored outputs/batch-.../ folder.
ChitraDev does not add hosted image-generation limits, remote credits, subscription gates, or repo-level prompt category restrictions. It is meant to run locally, so you control the model, cache, outputs, and environment configuration.
There are still local safety rails for stability and hardware fit. These are configurable in .env:
| Variable | Default | Purpose |
|---|---|---|
DEFAULT_WIDTH |
512 |
Default image width. Must be a multiple of 64. |
DEFAULT_HEIGHT |
512 |
Default image height. Must be a multiple of 64. |
DEFAULT_STEPS |
20 |
Default diffusion steps. |
DEFAULT_NUM_IMAGES |
1 |
Default images per request. |
MAX_WIDTH |
768 |
Maximum request width. Raise only if your GPU can handle it. |
MAX_HEIGHT |
768 |
Maximum request height. Raise only if your GPU can handle it. |
MAX_STEPS |
50 |
Maximum diffusion steps per request. |
MAX_NUM_IMAGES |
4 |
Maximum images per request. |
MAX_GUIDANCE_SCALE |
20 |
Maximum classifier-free guidance scale. |
DEFAULT_BATCH_TOTAL_IMAGES |
100 |
Default total outputs in the batch creator. |
MAX_BATCH_TOTAL_IMAGES |
500 |
Maximum outputs allowed for one batch job. |
DEFAULT_BATCH_CHUNK_SIZE |
1 |
Default images generated per batch chunk. |
MAX_BATCH_CHUNK_SIZE |
4 |
Maximum images generated per batch chunk. |
MAX_FACE_IMAGE_MB |
10 |
Maximum uploaded reference image size. |
If you hit GPU memory issues, lower the image size, step count, or output count.
Create .env from .env.example when you want to customize ChitraDev:
Copy-Item .env.example .envImportant settings:
HOSTandPORTcontrol the local FastAPI address.OUTPUT_DIRcontrols where generated PNGs and ZIPs are written.CACHE_DIRcontrols where model assets are cached.SD_BASE_MODELcontrols the Stable Diffusion model source.IP_ADAPTER_SOURCEandIP_ADAPTER_WEIGHTcontrol FaceID adapter assets.HF_TOKENcan be used for gated Hugging Face assets.LOCAL_FILES_ONLY=truekeeps model loading offline after assets are cached.DEFAULT_NEGATIVE_PROMPTsets the default negative prompt in the UI.
curl http://127.0.0.1:8000/healthThe response reports whether the service is alive and whether the model runtime has loaded.
The included tests cover settings loading, output saving and ZIP creation, prompt composition, and the web API with a stubbed inference service.
python -m unittest discover -s tests -vThe ChitraDev app repo is the local FastAPI generator. Host only the separate website repo, https://github.com/yuvrajraina/ChitraDevWeb, on Netlify.
The frontend includes netlify.toml with the expected Vite settings:
Build command: npm run build
Publish directory: dist
Node version: 20
After Netlify gives you a live URL, update the frontend SEO URL values if needed:
frontend/src/config/site.tsfrontend/index.htmlfrontend/public/robots.txtfrontend/public/sitemap.xml