younginpiniti's picture
feat: μ‚¬μš©μžμ—κ²Œ ν‘œμ‹œλ˜λŠ” λͺ¨λ“  정보 λ©”μ‹œμ§€λ₯Ό ν•œκ΅­μ–΄λ‘œ λ²ˆμ—­ν–ˆμŠ΅λ‹ˆλ‹€.
a11abf8
---
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** | μ• λ‹ˆλ©”μ΄μ…˜ νŠΉν™” |
## πŸš€ μ‚¬μš©λ²•
1. λ“œλ‘­λ‹€μš΄μ—μ„œ μ›ν•˜λŠ” λͺ¨λΈμ„ μ„ νƒν•©λ‹ˆλ‹€
2. ν”„λ‘¬ν”„νŠΈ μž…λ ₯창에 μ›ν•˜λŠ” 이미지λ₯Ό μ„€λͺ…ν•©λ‹ˆλ‹€
3. (선택) λ„€κ±°ν‹°λΈŒ ν”„λ‘¬ν”„νŠΈλ‘œ μ›ν•˜μ§€ μ•ŠλŠ” μš”μ†Œλ₯Ό μ§€μ •ν•©λ‹ˆλ‹€
4. 이미지 크기와 생성 μ˜΅μ…˜μ„ μ‘°μ ˆν•©λ‹ˆλ‹€
5. "πŸš€ 이미지 생성" λ²„νŠΌμ„ ν΄λ¦­ν•©λ‹ˆλ‹€
## πŸ’‘ ν”„λ‘¬ν”„νŠΈ μ˜ˆμ‹œ
```
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)**:
```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)**:
```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)
```python
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)
```python
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** - λ”₯λŸ¬λ‹ ν”„λ ˆμž„μ›Œν¬