Instructions to use damoncao/Anime_Image2Prompt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use damoncao/Anime_Image2Prompt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="damoncao/Anime_Image2Prompt") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("damoncao/Anime_Image2Prompt") model = AutoModelForMultimodalLM.from_pretrained("damoncao/Anime_Image2Prompt", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use damoncao/Anime_Image2Prompt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "damoncao/Anime_Image2Prompt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "damoncao/Anime_Image2Prompt", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/damoncao/Anime_Image2Prompt
- SGLang
How to use damoncao/Anime_Image2Prompt with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "damoncao/Anime_Image2Prompt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "damoncao/Anime_Image2Prompt", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "damoncao/Anime_Image2Prompt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "damoncao/Anime_Image2Prompt", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use damoncao/Anime_Image2Prompt with Docker Model Runner:
docker model run hf.co/damoncao/Anime_Image2Prompt
Anime_Image2Prompt
English
Model overview
Anime_Image2Prompt is a Qwen3.5-2B-based vision-language model that converts a single anime, illustration, or anime-style image into Danbooru-style prompt tags. It separates general visual attributes, character identities, and copyrights/franchises, making it useful for image organization, dataset annotation, and prompt extraction in generative-image workflows.
The repository contains all weights required for inference; no base model or separate adapter is needed. The model is stored in BF16, occupies approximately 4.12 GiB, and has 2,213,241,664 parameters. The included program loads local files from this directory by default.
Original-to-regeneration comparison
The following two pairs demonstrate the complete workflow. 01.png and 02.png are the original images. Each original was processed by Anime_Image2Prompt, and the extracted prompt was passed without manual rewriting directly to WAI-illustrious-SDXL v15.0. The resulting images are 01-regen.png and 02-regen.png, respectively.
| 01 ยท Original | 01 ยท Prompt regeneration |
|---|---|
![]() |
![]() |
| 02 ยท Original | 02 ยท Prompt regeneration |
![]() |
![]() |
These examples illustrate how the model captures major semantics such as character identity, clothing, scene, and composition. Prompt regeneration is not image-to-image or pixel-level reconstruction; the final image also depends on the generation model, random seed, and sampling settings.
Output format
The model's native output is a fixed JSON object:
{
"general_tags": ["1girl,long hair,blue eyes"],
"character_tags": ["example character"],
"copyright_tags": ["example copyright"]
}
general_tags: counts, appearance, clothing, actions, composition, and scene attributes.character_tags: character names recognized by the model.copyright_tags: recognized works or franchises.- Each non-empty category contains one comma-separated string. An unknown category is returned as an empty array,
[].
The included program can also combine all categories into a flat prompt:
1girl, long hair, blue eyes, example character, example copyright
Requirements
- Python 3.10 or newer; Python 3.11 is recommended.
- An NVIDIA GPU with at least 8 GB of VRAM is recommended. More VRAM provides additional headroom.
- CPU inference is supported but slow; at least 16 GB of system RAM is recommended.
- The weight file is larger than 4 GB. Use a large-file-capable filesystem such as NTFS, exFAT, APFS, or ext4 instead of FAT32.
Installation
Create a virtual environment inside the model directory:
python -m venv .venv
Windows PowerShell:
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Linux / macOS:
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
If you need a specific CUDA build, install the PyTorch build matching your GPU driver from the official PyTorch selector before installing the remaining requirements.
Quick start
The script resides beside the model files, so no model path is required:
python inference.py /path/to/image.png
The default output is structured JSON. Save it to a file with:
python inference.py /path/to/image.png --output result.json
Print a flat, copy-ready prompt instead:
python inference.py /path/to/image.png --format prompt
Useful options:
# Force CPU inference
python inference.py image.png --device cpu
# Reduce image tokens and peak VRAM usage
python inference.py image.png --low-vram
# Show every option
python inference.py --help
The program applies EXIF orientation and RGB conversion automatically and accepts common image formats supported by Pillow. Model loading uses local_files_only=True, so it does not download additional weights.
Python API
from inference import AnimeImage2Prompt
tagger = AnimeImage2Prompt()
result = tagger.predict("image.png")
print(result)
print(tagger.to_prompt(result))
Reuse the same AnimeImage2Prompt instance for multiple images to avoid reloading the model.
Limitations
- The model is intended primarily for anime and illustration images. Performance may degrade on photographs or images far outside its training distribution.
- Tags are not guaranteed to be exhaustive or correct. Character and franchise recognition can be especially uncertain.
- The model may return tags describing sensitive content. Apply content filtering appropriate to your use case and follow applicable laws and platform policies.
- Do not use the model as the sole basis for safety moderation, identity decisions, or other high-impact decisions.
License
This repository is released under the Apache License 2.0. See LICENSE for details.
ไธญๆ่ฏดๆ
ๆจกๅ็ฎไป
Anime_Image2Prompt ๆฏไธไธชๅบไบ Qwen3.5-2B ็ๅจๆผซๅพๅ็่งฃๆจกๅ๏ผๅฏๅฐๅๅผ ๅจๆผซใๆ็ปๆไบๆฌกๅ ้ฃๆ ผๅพ็่ฝฌๆขไธบ Danbooru ้ฃๆ ผ็ๆ็คบ่ฏใๆจกๅไผๅๅซ่ฏๅซ็ป้ข้็จ็นๅพใ่ง่ฒๅ็งฐๅไฝๅๆฅๆบ๏ผ้ๅ็จไบๅพ็ๅฝๆกฃใๆฐๆฎ้ๆ ๆณจๅ็ๆๅผๅพๅๅทฅไฝๆตไธญ็ๆ็คบ่ฏๆๅใ
ๆจกๅๆ้ๅทฒๅฎๆดๅ ๅซๅจๆฌไปๅบไธญ๏ผๆ ้้ขๅคไธ่ฝฝๅบ็กๆจกๅๆ้้ ๅจใๆ้ไปฅ BF16 ไฟๅญ๏ผ็บฆ 4.12 GiB๏ผๅ ฑ 2,213,241,664 ไธชๅๆฐใๆจ็็จๅบ้ป่ฎคๅช่ฏปๅๅฝๅ็ฎๅฝไธญ็ๆฌๅฐๆไปถใ
ๅๅพไธๆ็คบ่ฏ้็ปๅฏนๆฏ
ไธ้ขๅฑ็คบไธค็ป็ซฏๅฐ็ซฏๆๆๅฏนๆฏใ01.png ๅ 02.png ๆฏๅๅพ๏ผๅค็ๆต็จไธบ๏ผๅฐๅๅพ่พๅ
ฅ Anime_Image2Prompt๏ผๆๆจกๅๆๅๅบ็ๆ็คบ่ฏไธ็ปไบบๅทฅๆนๅ๏ผ็ดๆฅไบค็ป WAI-illustrious-SDXL v15.0 ็ปๅถ๏ผๅฏนๅบ็ปๆๅๅซไธบ 01-regen.png ๅ 02-regen.pngใ
| 01 ยท ๅๅพ | 01 ยท ๆ็คบ่ฏ้็ป |
|---|---|
![]() |
![]() |
| 02 ยท ๅๅพ | 02 ยท ๆ็คบ่ฏ้็ป |
![]() |
![]() |
่ฟไบ็คบไพ็จไบ่งๅฏๆจกๅๅฏน่ง่ฒใๆ้ฅฐใๅบๆฏๅๆๅพ็ญไธป่ฆ่ฏญไน็ๆๅ่ฝๅใๆ็คบ่ฏ้็ปๅนถ้ๅพ็ๅพๆๅ็ด ็บงๅคๅป๏ผๅ ทไฝ็ป้ขไปไผๅๅฐ็ปๅพๆจกๅใ้ๆบ็งๅญๅ้ๆ ทๅๆฐๅฝฑๅใ
่พๅบๆ ผๅผ
ๆจกๅๅ็่พๅบๅบๅฎไธบ JSON๏ผ
{
"general_tags": ["1girl,long hair,blue eyes"],
"character_tags": ["example character"],
"copyright_tags": ["example copyright"]
}
general_tags๏ผไบบ็ฉๆฐ้ใๅค่งใๆ้ฅฐใๅจไฝใๆๅพๅๅบๆฏ็ญ้็จๆ ็ญพใcharacter_tags๏ผๆจกๅ่ฝๅค่ฏๅซ็่ง่ฒๅ็งฐใcopyright_tags๏ผๆจกๅ่ฝๅค่ฏๅซ็ไฝๅๆ็ณปๅๅ็งฐใ- ๆฏไธช้็ฉบ็ฑปๅซๅ
ๅซไธไธชไปฅ่ฑๆ้ๅท่ฟๆฅ็ๅญ็ฌฆไธฒ๏ผๆ ๆณ่ฏๅซๆถ่ฟๅ็ฉบๆฐ็ป
[]ใ
้้็จๅบไนๅฏไปฅๆไธไธช็ฑปๅซๅๅนถไธบๅธธ็จ็ๆๅนณๆ็คบ่ฏ๏ผ
1girl, long hair, blue eyes, example character, example copyright
็ฏๅข่ฆๆฑ
- Python 3.10 ๆๆด้ซ็ๆฌ๏ผๆจ่ Python 3.11ใ
- ๆจ่ไฝฟ็จๅ ทๆ 8 GB ๆๆดๅคๆพๅญ็ NVIDIA GPU๏ผๆพๅญ่ถๅคง๏ผ่ฟ่ก่ถ็จณๅฎใ
- CPU ๅฏไปฅ่ฟ่ก๏ผไฝ้ๅบฆ่พๆ ข๏ผๅปบ่ฎฎ่ณๅฐๅๅค 16 GB ็ณป็ปๅ ๅญใ
- ๆจกๅๆไปถๅคงไบ 4 GB๏ผ่ฏทไฝฟ็จ NTFSใexFATใAPFSใext4 ็ญๆฏๆๅคงๆไปถ็ๆไปถ็ณป็ป๏ผไธ่ฆไฝฟ็จ FAT32ใ
ๅฎ่ฃ
ๅจๆจกๅ็ฎๅฝไธญๅๅปบ่ๆ็ฏๅขๅนถๅฎ่ฃ ไพ่ต๏ผ
python -m venv .venv
Windows PowerShell๏ผ
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Linux / macOS๏ผ
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
ๅฆๆ้่ฆ็นๅฎ CUDA ็ๆฌ๏ผ่ฏทๅ ๆ็ ง PyTorch ๅฎๆนๅฎ่ฃ ่ฏดๆ ๅฎ่ฃ ไธๆพๅก้ฉฑๅจๅน้ ็ PyTorch๏ผๅๆง่กไพ่ตๅฎ่ฃ ๅฝไปคใ
ๅฟซ้ไฝฟ็จ
ๆจ็่ๆฌไธๆจกๅๆพๅจๅไธ็ฎๅฝ๏ผๅ ๆญคๆ ้ๅกซๅๆจกๅ่ทฏๅพ๏ผ
python inference.py /path/to/image.png
้ป่ฎคๅจ็ป็ซฏ่พๅบ็ปๆๅ JSONใไฟๅญ็ปๆ๏ผ
python inference.py /path/to/image.png --output result.json
็ดๆฅ่พๅบๅฏๅคๅถ็ๆๅนณๆ็คบ่ฏ๏ผ
python inference.py /path/to/image.png --format prompt
ๅธธ็จ้้กน๏ผ
# ๅผบๅถไฝฟ็จ CPU
python inference.py image.png --device cpu
# ้ไฝๅพๅ token ๆฐไปฅๅๅฐๅณฐๅผๆพๅญๅ ็จ
python inference.py image.png --low-vram
# ๆฅ็ๅ
จ้จๅๆฐ
python inference.py --help
็จๅบไผ่ชๅจๅค็ๅพ็็ EXIF ๆนๅๅนถ่ฝฌๆขไธบ RGB๏ผๆฏๆ Pillow ๅฏ่ฏปๅ็ๅธธ่งๅพ็ๆ ผๅผใๅ ่ฝฝๆจกๅๆถไฝฟ็จ local_files_only=True๏ผไธไผ่็ฝไธ่ฝฝๅ
ถไปๆ้ใ
Python ่ฐ็จ
from inference import AnimeImage2Prompt
tagger = AnimeImage2Prompt()
result = tagger.predict("image.png")
print(result)
print(tagger.to_prompt(result))
ๅไธไธช AnimeImage2Prompt ๅฎไพๅฏ่ฟ็ปญๅค็ๅคๅผ ๅพ็๏ผๆจกๅๅชไผๅ ่ฝฝไธๆฌกใ
ไฝฟ็จ้ๅถ
- ๆฌๆจกๅไธป่ฆ้ขๅๅจๆผซๅๆ็ปๅพ็๏ผ็ๅฎ็ ง็ๆไธ่ฎญ็ปๅๅธๅทฎๅผ่พๅคง็ๅพ็ๅฏ่ฝ่กจ็ฐ่พๅทฎใ
- ๆ ็ญพๅนถไธไฟ่ฏๅฎๆดๆๅฎๅ จๅ็กฎ๏ผ่ง่ฒไธไฝๅๆฅๆบๅฐคๅ ถๅฏ่ฝๅ็่ฏฏ่ฏๅซใ
- ๆจกๅๅฏ่ฝ่พๅบๆๆๅ ๅฎนๆ ็ญพใไฝฟ็จ่ ๅบๆ นๆฎๅบ็จๅบๆฏ่ฟ่กๅ ๅฎน่ฟๆปค๏ผๅนถ้ตๅฎๅฝๅฐๆณๅพๅๅนณๅฐ่งๅใ
- ๆฌๆจกๅไธๅบไฝไธบๅฎๅ จๅฎกๆ ธใ่บซไปฝๅคๆญๆๅ ถไป้ซ้ฃ้ฉๅณ็ญ็ๅฏไธไพๆฎใ
่ฎธๅฏ่ฏ
ๆฌไปๅบไพๆฎ Apache License 2.0 ๅๅธ๏ผ่ฏฆๆ
่ง LICENSEใ
- Downloads last month
- 10




docker model run hf.co/damoncao/Anime_Image2Prompt