--- title: Anima Collection+ MCP emoji: 📚 colorFrom: blue colorTo: indigo sdk: gradio sdk_version: 6.23.1 python_version: '3.12' app_file: app.py pinned: false hf_oauth: true hf_oauth_expiration_minutes: 480 --- # Anima Collection+ MCP Gradio + ComfyUI text-to-image Space with model-family-isolated pages and an MCP-compatible public generation endpoint. Anima Collectionをベースに、まずMCPサーバ機能を追加し、その後Illustrious対応・ 複数モデル対応・お気に入りなどを拡張したフォークです。 「+」は元のAnima Collectionからの機能拡張を表します。 この検証版のSpace URLは `yamiuchi/anima-collection-plus-mcp` です。 元のSpaceとは別の接続先です。動作確認後はPause状態で保留します。 ## WebUI pages - **Anima** — Anima-only checkpoints and LoRAs. The WebUI provides three isolated presets: official Turbo (8 steps, CFG 1, Turbo LoRA disabled), non-Turbo + Turbo LoRA (8 steps, CFG 1, experimental), and standard non-Turbo (30 steps, CFG 4, Turbo LoRA disabled). - **Illustrious** — Illustrious XL v2.0 checkpoint, CLIP skip 2, and an isolated LoRA list. WAI-illustrious defaults are 30 steps, CFG 5, Euler a / `normal`, and WAI's `masterpiece, best quality, amazing quality` prompt tags. The WebUI separates WAI standard and DMD2 fast presets; DMD2 uses 8 steps, CFG 1.6, LCM / `normal`, and LoRA 4 strength 0.7. Its VAE selector defaults to the checkpoint-embedded VAE and can switch to Stability AI's SDXL VAE or the Illustrious XL v1.0 VAE. - **Krea2** — reserved family page with its natural-language and 8-step Turbo defaults. Generation stays disabled until Krea2 weights and its Qwen3-VL text encoder are explicitly added to this Space. Checkpoint and LoRA candidates are never shared between family pages. ### Anima Checkpoint samples Checkpoint直下の「モデルの特徴・サンプルはこちら」は初期状態では閉じています。 選択中のAnimaモデルごとに、実際のSpaceで生成した上半身・人物+背景の2枚を表示します。 Aestheticは共通設定2枚に加え、ポジティブのクオリティタグを省略した推奨設定の一例2枚を併記します。 公式説明へのリンク・変更点・生成条件・プロンプトも表示します。 サンプル閲覧やCheckpoint切り替えによって生成設定を書き換えたり、GPUジョブを実行したりしません。 生成元・画像のSHA-256を含む記録は[`assets/model_samples/anima/`](assets/model_samples/anima/README.md)に保存しています。 ## 日本語・英語タグ検索 Anima / IllustriousのPositive・Negative欄で、日本語訳・読み・同義語から英語タグを検索できます。 部分一致と空白区切りのAND検索に対応し、通常候補20件に加えて検索パネルで全結果を20件ずつ閲覧できます。 候補の選択時だけカーソル位置のタグを置換します。検索中は既存Promptを変更しません。 成人向け語彙を一律に除外するフィルターはありません。約10万件の日本語辞書には機械訳・未訳も含まれます。 タグ検索はブラウザ内で完結し、GPU・外部翻訳API・運営者のAPIキーは使いません。 出典・形式・操作方法は[辞書README](tags/README.md)を参照してください。 ## LoRA selection and JujoHotaru collection The highlighted LoRA accordion provides four optional slots. `---` means no selection and is always skipped during generation, even if Enable is submitted as true through the API. Anima LoRA 3 and Illustrious LoRA 2/3 start with `---` and Enable off. Anima LoRA 1 (P3 Aesthetics Details) and LoRA 2 (GPT-Image Anima Base) also start disabled, with their filenames selected and strengths kept at 0.8. Users can enable both slots manually to use the previous default LoRA configuration. The temporary initial-settings-change announcement has been removed. The author-published [JujoHotaru Anima collection](https://huggingface.co/JujoHotaru/anima_lora) (87 files) and [SDXL collection](https://huggingface.co/JujoHotaru/lora/blob/main/sdxl/README.md) (188 SDXL files: 171 general/Illustrious and 17 Pony-targeted) are registered separately. Pony releases appear last, labelled `Pony用・ILL未検証`, with compatibility warnings in the selector and sample details. Their author samples do not guarantee reproduction on Illustrious. SD1.5 and superseded versions remain excluded. Existing LoRAs remain at the top of each list; author LoRAs show series names and filenames. The initially collapsed sample browser sits directly below LoRA settings and above Generate on both PC and mobile, and provides category/search filters and paginated author-hosted thumbnails (8 per page on PC, 4 on mobile). PC shows details alongside the list when space permits, or below it in a narrow column; mobile opens a detail dialog and restores the list position when it closes. Tap/click the preview image to enlarge it. Some images compare a whole series rather than one file. For Eye Collection XL, all 81 code entries instead show the author's individual Illustrious example matching that exact code (not the adjacent Pony example). Cards show short codes such as `code127`; the detail view identifies the Tareme/Tsurime type and the prompt tag used for that sample. Thumbnails, details, and zoom use the same code-specific image. Catalog sample references can be refreshed without changing registered weights or the pinned revision with `python scripts/update_jujo_catalog.py --eyecolle-samples-only`. Comic eyes (registered Types 1/4) and Half closed eyes helper v3 (Types 1/2) also use the matching type/version sample, not a shared header or thumbnail. Pupil collection Types 1-6 use CSS framing of the corresponding labeled cell in the author's unmodified comparison sheet in cards, detail, and zoom. A link opens the complete Original/Types 1-6 sheet; no cropped image is redistributed, and these samples are not labelled as Illustrious output without author evidence. Refresh only these 10 sample entries (preserving weights and revisions) with `python scripts/update_jujo_catalog.py --eye-types-samples-only`. Viewing samples or choosing a destination does not change generation settings. In the details, select LoRA 1-4 and a strength, then explicitly apply to replace that slot's file/strength and enable it. Other slots retain their settings. The initial destination prioritizes an empty slot, then a disabled slot; if all four are active, the user must choose a destination. The current contents of that slot are displayed before applying. Standard recommended presets still control LoRA 4 when a preset is selected afterward. The browser only exposes private WebUI events; the public generation/MCP contract is unchanged. CPU-only regression checks are available with `python -m unittest discover -s tests -p 'test_jujo*.py'` and the local `tests/lora_ui_demo.py` + Playwright `tests/jujo_browser_ui.cjs` fixture. Additional JujoHotaru weights download on first enabled use, inside the serialized job but before the ZeroGPU worker is requested, then reuse the local cache. ## Remember previous WebUI settings ### Named favorites Name search filters the current mode's list by substring (case/width-insensitive). An empty query shows all entries. A selection hidden by search is cleared to prevent accidental overwrite/deletion. Search never changes stored entries; Export and Clear All always cover the entire current mode, even while filtered. Export filenames follow the displayed project name: `anima-collection-plus-mcp-favorites-anima.json` and `anima-collection-plus-mcp-favorites-illustrious.json`. New JSON uses the `anima-collection-plus-mcp-favorites` format identifier; legacy `imggen-favorites` JSON is still importable. Existing browser storage keys are deliberately unchanged, so saved settings/favorites need no migration. The Japanese UI labels Apply as **設定を読み込む** and explains that it fills the controls without generating an image. Settings/favorites panels disclose that clearing cookies/site data or resetting the browser removes local saves (ordinary image/file cache clearing normally does not), private sessions are temporary, and JSON export is needed for favorites backup/migration. Anima and Illustrious each provide an initially collapsed **お気に入り** panel. Save up to 100 named configurations per mode in this browser, independently of automatic settings storage. Explicit Add/Overwrite includes both prompts, checkpoint, sampling, dimensions, all LoRA slots and ILL VAE/embeddings. Apply restores manual values without running generation or reapplying preset defaults. Choose the input seed (`-1` stays random) or the latest completed generation's actual seed. Favorite seed values are exported as decimal strings and retained server-side per session on Apply to avoid browser rounding of 64-bit seeds; manual Seed edits clear that exact-seed override. Add, Apply, Overwrite, Delete, Export, Import and Clear All are available. Overwrite/Delete/Clear require confirmation. Clear affects only the current mode's favorites, not current inputs or automatic settings. JSON export covers all favorites in the current mode. Import appends without overwriting same-name entries, validates format/version/family, field types/ranges and limits (100 entries, 5 MB, 80-character names). Unknown fields are stripped; missing choices fall back with a warning on Apply, and missing LoRAs are disabled. Import does not fetch URLs, download models or execute code. No images or credentials are saved. JSON includes prompts: take care when sharing. Browser data is not account-synced; export/import is the migration/backup method. Storage failure reports an error without replacing the current list. UI events may send settings to the Space, but no favorites are written to server-side files. Public MCP API is unchanged. ### Automatic settings Each generation page also displays a daily-count notice near the bottom: successful generations are counted per model to inform lineup replacements. The statistics contain only date, mode, model name and aggregate count, not prompts, generated images or identifying user information. This disclosure describes the application counter, not Hugging Face's separate platform logs. Each mode has a separate, initially collapsed **設定の保存・初期化(このブラウザ)** panel. Settings storage and prompt storage are both ON by default. Existing saved ON/OFF preferences are respected. Checkpoint, preset selection, dimensions, seed input (including `-1` random), sampling, LoRA file/strength/enabled state, and Illustrious VAE/embeddings are restored automatically, without opening the panel or starting generation. Restored manual adjustments take precedence over preset defaults. Presets still apply normally when the user explicitly selects one. The implementation uses a small Gradio HTML/localStorage bridge with stable, versioned, per-family keys, so server restarts do not invalidate saved settings. It does not depend on a browser encryption key or claim to protect secrets. Data is local to that browser/profile and is not synced across devices or HF accounts. Shared-browser users can see each other's saved preferences. Prompt storage can be disabled independently. Disabling it removes both saved prompts; disabling settings storage or choosing **保存設定を削除** removes settings and leaves only an OFF preference marker. **初期設定に戻す** resets the current mode's values; it respects the current storage preferences. No credentials or images are saved. Restored data is allowlisted and range-checked against the current mode's controls; missing/removed LoRAs are disabled. Prompts remain plain text. Unavailable/corrupt localStorage falls back to normal initial UI settings. Persistence is not a privacy boundary: UI events and restoration can send field values to the Space. This feature does not write prompts to server-side files. Storage/restore callbacks are private WebUI events and leave `generate_image` unchanged. CPU browser regression: `node tests/browser_settings_ui.cjs` against `tests/lora_ui_demo.py` (PC and mobile; no model/GPU required). ## Daily generation counts (best effort) Successful WebUI and MCP generations share one in-memory counter outside the ZeroGPU worker. One returned image increments the actual checkpoint's count by one, using its completion date in **Asia/Tokyo**. Failed calls do not increment. Only dates, model families, checkpoint names, and counts are stored — no image, prompt, IP address, user identity, or job history. A single daemon thread restores the saved JSON on startup and writes a snapshot every **300 seconds**, only when counts have changed. Generation never waits for storage I/O. Save failures are logged and retried next interval. Abrupt shutdown can lose unsaved counts (normally about the last five minutes; longer during storage failure). This is operational telemetry, not billing-grade accounting. It assumes **one Space process / replica** writes each statistics directory; do not share it between replicas or separate Spaces. ### Public statistics viewer The bottom **利用状況・生成統計** accordion is collapsed by default and publicly readable without login. `ADMIN_USERS` is no longer used in this application. Only model-level aggregate counts are displayed, not prompts, images or user information. The counts help inform model replacements. Report events remain private in the Gradio API listing and outside the generation queue; this is not an access restriction. Public `generate_image` remains unchanged. The viewer reads `GENERATION_STATS_DIR/daily-counts.json` from the existing read-write bucket mount without flushing or changing that file. Yesterday and today use JST; the second table uses the same mode/model row order, with previous-month and current-month totals side by side. Column headers include the relevant year/month. Both tables include totals and registered models with zero counts. Only currently selectable checkpoints are displayed by default. The unchecked 「過去のモデルも表示」 option reveals historically recorded models without deleting or merging their saved records. Daily and monthly totals are labelled 「表示中のモデル合計」 and cover only the displayed models. Both tables use auto-height read-only HTML with escaped cell text, wrapped model names and right-aligned counts, so scrolling stays on the page rather than inside a table. The view includes fetch/file-update times and a reminder of the normal five-minute save lag and partial current month. Missing, unset or corrupt storage shows an error instead of misleading zero counts; no filesystem details are exposed. Statistics remain private in `yamiuchi/anima-collection-stats`; do not expose the mount through Gradio static/allowed paths. No extra token scope or bucket visibility change is needed for mounted reads. Only the aggregate report is public; the bucket itself need not be made public. Forks must configure their own mount and must not share the same writable statistics directory with another Space. ### Persistent storage setup 1. Create a **private HF Storage Bucket** for statistics and attach it to the Space as a read-write volume, for example at `/data/stats`. Preserve existing mounted volumes when adding it. Bucket creation/billing and the volume must be configured separately; this code does not provision or change resources. 2. Set the Space variable `GENERATION_STATS_DIR=/data/stats` (or the actual writable mount path). The Space must have the required bucket write access. 3. The resulting file is `/data/stats/daily-counts.json`. It restores automatically on subsequent starts. Keep it outside Gradio static/allowed file paths. With the variable unset, counts are **memory-only**, and startup logs a warning; the app does not pretend an ephemeral local directory is persistent. For local development, point the variable at the ignored `generation-stats/` directory. The mounted model-repository volume is read-only and is not a statistics store. See [HF Spaces storage](https://huggingface.co/docs/hub/spaces-storage) for Bucket volumes and storage pricing. No bucket or Space settings were created automatically as part of the implementation. Example JSON shape: ```json {"version":1,"timezone":"Asia/Tokyo","counts":{"2026-10-14":{"anima":{"anima-turbo-v1.1.safetensors":12},"illustrious":{"waiIllustriousSDXL_v170.safetensors":7}}}} ``` CPU regression tests: `python -m unittest discover -s tests -p 'test_*.py'`. They are not downloaded or preloaded onto the GPU at startup. Download time is additional wall-clock waiting time, outside the decorated GPU generation call. Using every optional weight over time can add about 12.53 GB of disk usage. The pinned metadata and author licenses/notices are in `assets/jujo/`. Anima derivatives use the CircleStone Labs Non-Commercial License; the SDXL collection is offered under MIT or CreativeML Open RAIL-M. The WebUI credits link to the author's original distribution pages and the applicable terms. `python scripts/update_jujo_catalog.py` refreshes metadata without downloading model weights; review compatibility and sample references before deploying it. ## Tag completion Anima and Illustrious provide tag completion in both Prompt and Negative prompt. Type at least two characters to see up to 20 suggestions. Use Up/Down to select, Tab/Enter or a click to insert, Esc to dismiss, and Shift+Enter for a newline. The controls below each prompt can disable completion or filter tag categories. Suggestions include tag aliases and use the bundled Danbooru CSV plus quality tags. The current tag is replaced while prompt weights and other text are kept. CSV data loads once per browser page; searches run in the browser without GPU time or generation queue use. Public MCP inputs and outputs remain unchanged. See [tag data, attribution and UI checks](tags/README.md). ## Models ### Anima INT8 backend All five Anima checkpoints are prequantized INT8 files fetched from `yamiuchi/civitai-collections/checkpoints/anima`. Normal BF16 variants are commented out, not downloaded or preloaded. The default remains official Turbo, now its INT8 version. | INT8 file | Legacy API / saved-setting names | Size (bytes) | | --- | --- | ---: | | `anima-turbo-v1.1_INT8.safetensors` | `anima-turbo-v1.1.safetensors` | 2,423,565,752 | | `anima-aestheticV11_INT8.safetensors` | `anima-aesthetic-v1.1.safetensors`, `anima_aestheticV11.safetensors`, `anima-aestheticV11.safetensors`, `anima_aestheticV11_INT8.safetensors` | 2,423,562,380 | | `fnMixAnimaTurbo_baseNoTurbo_INT8.safetensors` | `fnMixAnimaTurbo_baseNoTurbo.safetensors` | 2,423,761,252 | | `fwaunAnima_v11_INT8.safetensors` (added) | `fwaunAnima_v11.safetensors` | 2,423,562,788 | | `tekitoMix_v32_INT8.safetensors` | `tekitoMix_v32.safetensors` | 2,423,565,796 | Total checkpoint storage is about 12.12 GB, excluding encoders, VAE and LoRAs. For comparison, tekitoMix BF16 was 4,182,234,096 bytes: INT8 saves about 1.76 GB / 42.05%. This is not a measurement of process RAM, VRAM, startup time or generation speed. Existing BF16 files in reused runtime/cache directories are deliberately not deleted automatically; the saving applies to the new download/preload set. INT8 Anima entries use **ComfyUI-INT8-Fast / OTUNetLoaderW8A8**, pinned to [`48a88b2fde88e986c6444fa1f51589b6089d04f3`](https://github.com/BobJohnson24/ComfyUI-INT8-Fast/tree/48a88b2fde88e986c6444fa1f51589b6089d04f3), matching the local workflow. Settings: `weight_dtype=default`, `model_type=anima`, `on_the_fly_quantization=False`, `enable_convrot=True`, `lora_mode=None` (the string `"None"`). Existing LoRAs still use `LoraLoaderModelOnly` with the node's INT8 patcher. The standard loader remains available for future non-INT8 entries; Illustrious is unchanged. The node uses Triton where available, with its upstream torch INT8 fallback. The existing platform-pinned PyTorch/ComfyUI dependencies are not upgraded. The node is cloned into the Space's runtime ComfyUI custom_nodes directory and imported in-process before model preloading. A mismatched/modified node checkout stops startup rather than deleting local edits or silently following upstream. Registered INT8 files must contain INT8 weights and quantization settings; errors do not fall back to BF16 downloads. No startup quantization or model conversion is performed. Legacy API/MCP names listed above and saved browser settings/favorites resolve to the INT8 replacement; recorded generation info uses the actual INT8 filename. Public function arguments and return types are unchanged. The node is provided by BobJohnson24 under AGPL-3.0; its source and license are linked from the Anima credits. Model author credits and model license obligations remain separate. Local code/routing tests do not establish ZeroGPU, kernel, image quality or sequential LoRA-switching compatibility. Verify those before deployment. | File | Source | | --- | --- | | 5 Anima INT8 checkpoints (Turbo v1.1, Aesthetic v1.1, fnMix BaseNoTurbo, Fwaun v1.1, tekitoMix v3.2) | `yamiuchi/civitai-collections` `checkpoints/anima/`; original author links in WebUI credits | | 6 Anima LoRAs | `yamiuchi/civitai-collections` `lora/anima/` | | `qwen_3_06b_base.safetensors` (text encoder) | `circlestone-labs/Anima` | | `qwen_image_vae.safetensors` (VAE) | `circlestone-labs/Anima` | | 4 Illustrious checkpoints (`waiIllustriousSDXL_v170`, `kiwimixXL_v3`, `mhillustrious_v10`, `zukiAnimeILL_v50`) | `yamiuchi/civitai-collections` `checkpoints/sdxl/` | | `Detail_Tweaker_Illustrious_BSY_V3.safetensors` (Illustrious detail LoRA) | `Stableyogi/Detail-Tweaker-Illustrious` | | `Hyper-SDXL-8steps-CFG-lora.safetensors` | `ByteDance/Hyper-SD` | | `dmd2_sdxl_4step_lora.safetensors` | `yamiuchi/civitai-collections` `lora/sdxl/` | | `sdxl_vae.safetensors` | `stabilityai/sdxl-vae` | | `illustriousXLV10_v10.safetensors` | `yamiuchi/civitai-collections` `vae/sdxl/` | The Illustrious WebUI exposes SDXL LoRAs, including explicitly labelled, unverified Pony releases. It never offers the separate Anima LoRA list. ## Persistent model volume (`imggen-mcp`) The `imggen-mcp` clone mounts the private `yamiuchi/civitai-collections` model repository read-only at `/mnt/models`. At startup, files found in that volume are symlinked into the ComfyUI model directories, so the large private checkpoints and LoRAs are not copied into the ephemeral Space container. If the volume is unavailable, the app retains the existing authenticated Hub download fallback. The public Space/API contract is unchanged. ## MCP / Gradio API compatibility The public endpoint remains `generate_image`. Its input types, labels, order, and two outputs are unchanged: 1. checkpoint, prompt, negative prompt 2. width, height, seed, steps, CFG, sampler, scheduler 3. four repetitions of LoRA enable, filename, and strength Existing Anima clients continue to work. To call Illustrious through the same endpoint, select `Illustrious-XL-v2.0.safetensors` and disable all Anima LoRA slots. The public endpoint keeps its existing argument list and uses the checkpoint-embedded VAE for Illustrious; VAE selection is WebUI-only. ## Setup 1. Create a Space with Gradio SDK, hardware **ZeroGPU**, size `large`. 2. First cold start clones the pinned ComfyUI commit and downloads the declared Anima and Illustrious assets; this is a large download. 3. Optional: `HF_TOKEN` secret if any repo becomes gated (none are today). 4. Optional: `GPU_DURATION` env var (default 30s) to tune the ZeroGPU window. Workflow: [`image_anima_base_v1.json`](https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_anima_base_v1.json). ## Prompting (from the official Anima README) - Defaults: 30 steps, CFG 4, `er_sde` / `simple`. - Recommended positive prefix: `masterpiece, best quality, score_7, safe, ` - Recommended negative: `worst quality, low quality, score_1, score_2, score_3, artist name, blurry, jpeg artifacts, chromatic aberration` - Use lowercase Danbooru-style tags, spaces instead of underscores; score tags keep underscores; prefix artist tags with `@`. ## Illustrious defaults - Resolution: 1:1 (1024x1024) - WAI standard: 30 steps, CFG 5, `euler_ancestral` / `normal`, with DMD2 disabled - DMD2 fast preset: 8 steps, CFG 1.6, `lcm` / `normal`, LoRA 4 strength 0.7 - CLIP skip: 2 (`stop_at_clip_layer=-2`) - VAE: checkpoint-embedded by default; Stability AI SDXL VAE and Illustrious XL v1.0 VAE are selectable in the WebUI - Positive prefix: `masterpiece, best quality, amazing quality,` - Negative default: `bad quality,worst quality,worst detail,sketch,censor, bad hands, extra arms, extra hands, extra fingers, long body, logo, emblem, text,` - Negative Embeddings are selectable but start disabled. Use only embeddings compatible with the checkpoint family. - Excessive CFG or strong weighting of Negative tags can destabilize saturation, outlines, and composition.