feat: ์ฌ์ฉ์์๊ฒ ํ์๋๋ ๋ชจ๋ ์ ๋ณด ๋ฉ์์ง๋ฅผ ํ๊ตญ์ด๋ก ๋ฒ์ญํ์ต๋๋ค.
a11abf8
metadata
title: Stable Diffusion WebUI
emoji: ๐ธ
colorFrom: pink
colorTo: purple
sdk: docker
pinned: false
๐ธ Anime Diffusion WebUI
ํ๊น ํ์ด์ค ์คํ์ด์ค์์ ์คํ๋๋ ์ ๋๋ฉ์ด์ ์คํ์ผ ์ด๋ฏธ์ง ์์ฑ๊ธฐ์ ๋๋ค.
โจ ๊ธฐ๋ฅ
- ํ ์คํธ โ ์ด๋ฏธ์ง (txt2img): ํ๋กฌํํธ๋ฅผ ์ ๋ ฅํ์ฌ ์ด๋ฏธ์ง ์์ฑ
- ์ด๋ฏธ์ง โ ์ด๋ฏธ์ง (img2img): ๊ธฐ์กด ์ด๋ฏธ์ง๋ฅผ ์ ๋๋ฉ์ด์ ์คํ์ผ๋ก ๋ณํ
- ๋ค์ํ ์ ๋๋ฉ์ด์ ๋ชจ๋ธ: 8๊ฐ์ง ์ธ๊ธฐ ๋ชจ๋ธ ์ง์
- ๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ: ์ํ์ง ์๋ ์์ ์ ์ธ
- ๋ณํ ๊ฐ๋ ์กฐ์ : img2img์์ ์๋ณธ ์ ์ง ์ ๋ ์กฐ์
- REST API ์ง์: ์ธ๋ถ ์ฑ์์ API ํธ์ถ ๊ฐ๋ฅ
๐ค ์ง์ ๋ชจ๋ธ
| ๋ชจ๋ธ | ํน์ง |
|---|---|
| Mistoon Anime V3 โญ | ์นดํฐํ ์ ๋๋ฉ์ด์ , ์ ๋ช ํ ์์, ๋๊บผ์ด ์ธ๊ณฝ์ |
| Anything V5 | ๊ฐ์ฅ ์ธ๊ธฐ ์๋ ์ ๋๋ฉ์ด์ ๋ชจ๋ธ |
| Counterfeit V3 | ๊ณ ํ์ง ์ ๋๋ฉ์ด์ /์ผ๋ฌ์คํธ |
| DreamShaper V8 | ๋ค์ํ ์คํ์ผ ์ง์ |
| OpenJourney V4 | Midjourney ์คํ์ผ |
| Stable Diffusion v1.5 | ๊ธฐ๋ณธ ๋ชจ๋ธ |
| MeinaMix V11 | ๊ณ ํ๋ฆฌํฐ ์ ๋๋ฉ์ด์ |
| ReV Animated | ์ ๋๋ฉ์ด์ ํนํ |
๐ ์ฌ์ฉ๋ฒ
- ๋๋กญ๋ค์ด์์ ์ํ๋ ๋ชจ๋ธ์ ์ ํํฉ๋๋ค
- ํ๋กฌํํธ ์ ๋ ฅ์ฐฝ์ ์ํ๋ ์ด๋ฏธ์ง๋ฅผ ์ค๋ช ํฉ๋๋ค
- (์ ํ) ๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ๋ก ์ํ์ง ์๋ ์์๋ฅผ ์ง์ ํฉ๋๋ค
- ์ด๋ฏธ์ง ํฌ๊ธฐ์ ์์ฑ ์ต์ ์ ์กฐ์ ํฉ๋๋ค
- "๐ ์ด๋ฏธ์ง ์์ฑ" ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค
๐ก ํ๋กฌํํธ ์์
1girl, solo, long blue hair, blue eyes, school uniform,
cherry blossoms, masterpiece, best quality, detailed
โ ๏ธ ์ฃผ์์ฌํญ
- CPU ๋ชจ๋์์๋ ์ด๋ฏธ์ง ์์ฑ์ 2-5๋ถ ์ ๋ ์์๋ฉ๋๋ค
- ์ฒซ ์คํ ์ ๋ชจ๋ธ ๋ค์ด๋ก๋๋ก ์ถ๊ฐ ์๊ฐ์ด ํ์ํฉ๋๋ค
- GPU ์คํ์ด์ค๋ฅผ ์ฌ์ฉํ๋ฉด ํจ์ฌ ๋น ๋ฅธ ์์ฑ์ด ๊ฐ๋ฅํฉ๋๋ค
๐ REST API ์ฌ์ฉ๋ฒ
์ด ํ๋ก์ ํธ๋ ์น ์ธํฐํ์ด์ค๋ฟ๋ง ์๋๋ผ REST API๋ ์ ๊ณตํฉ๋๋ค.
1. ํ ์คํธ โ ์ด๋ฏธ์ง API (txt2img)
- ์๋ํฌ์ธํธ:
POST /api/generate - ๋ณธ๋ฌธ ๊ตฌ์กฐ (JSON):
{
"prompt": "์์ฑํ ํ๋กฌํํธ (ํ์)",
"negative_prompt": "์ ์ธํ ํ๊ทธ (์ ํ)",
"model_name": "์ฌ์ฉํ ๋ชจ๋ธ ์ด๋ฆ (์ ํ)",
"width": 512,
"height": 512,
"num_inference_steps": 25,
"guidance_scale": 7.5,
"seed": -1
}
2. ์ด๋ฏธ์ง โ ์ด๋ฏธ์ง API (img2img)
- ์๋ํฌ์ธํธ:
POST /api/img2img - ๋ณธ๋ฌธ ๊ตฌ์กฐ (JSON):
{
"image_base64": "Base64๋ก ์ธ์ฝ๋ฉ๋ ์
๋ ฅ ์ด๋ฏธ์ง (ํ์)",
"prompt": "๋ณํํ ์คํ์ผ ํ๋กฌํํธ (ํ์)",
"negative_prompt": "์ ์ธํ ํ๊ทธ (์ ํ)",
"model_name": "์ฌ์ฉํ ๋ชจ๋ธ ์ด๋ฆ (์ ํ)",
"strength": 0.75,
"num_inference_steps": 25,
"guidance_scale": 7.5,
"seed": -1
}
3. Python ํธ์ถ ์์ (txt2img)
import requests
import base64
url = "https://your-space.hf.space/api/generate"
payload = {
"prompt": "1girl, anime, long hair, masterpiece",
"negative_prompt": "bad anatomy, blurry",
}
response = requests.post(url, json=payload)
data = response.json()
if data["success"]:
with open("output.png", "wb") as f:
f.write(base64.b64decode(data["image_base64"]))
4. Python ํธ์ถ ์์ (img2img)
import requests
import base64
# ์ด๋ฏธ์ง๋ฅผ Base64๋ก ์ธ์ฝ๋ฉ
with open("input.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
url = "https://your-space.hf.space/api/img2img"
payload = {
"image_base64": image_base64,
"prompt": "anime style, colorful, masterpiece",
"strength": 0.75
}
response = requests.post(url, json=payload)
data = response.json()
if data["success"]:
with open("output.png", "wb") as f:
f.write(base64.b64decode(data["image_base64"]))
๐ ๏ธ ๊ธฐ์ ์คํ
- FastAPI / Uvicorn - REST API ์๋ฒ
- Gradio - ์น ์ธํฐํ์ด์ค
- Diffusers - ํ๊น ํ์ด์ค ๋ํจ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- Docker - ์ปจํ ์ด๋ ํ๊ฒฝ
- PyTorch - ๋ฅ๋ฌ๋ ํ๋ ์์ํฌ