Spaces:
Running
on
Zero
A newer version of the Gradio SDK is available:
5.42.0
title: Magic Face V3
emoji: ๐คช
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: mit
short_description: Source-code Include
Looking at this code, it's a Gradio-based web application called "MagicFace V3" that uses IP-Adapter technology to transform user faces into various character styles. Here's a detailed explanation:
English Explanation
Overview
MagicFace V3 is an AI-powered face transformation application that uses Stable Diffusion with IP-Adapter FaceID technology. It allows users to upload their photos and transform them into various artistic styles or fictional characters while preserving their facial identity.
Key Features
- Face Identity Preservation: Uses InsightFace for face detection and embedding extraction, ensuring the generated images maintain the user's facial features
- Multiple Image Support: Can process multiple photos of the same person to create a better average representation
- Preset Styles: Offers 10 pre-configured transformation styles including:
- Classic art styles (Mona Lisa, Van Gogh)
- Fictional characters (Iron Hero, Star Wars Jedi, Matrix Hero)
- Historical figures (Egyptian Pharaoh, Greek God, Medieval Knight)
- Adventure themes (Pirate Captain, Sherlock Holmes)
- Custom Prompts: Users can write their own transformation descriptions
- Gender Selection: Optimizes generation based on selected gender
Technical Components
- Base Model: Realistic_Vision_V4.0_noVAE
- IP-Adapter: FaceID and FaceID Plus models for facial feature preservation
- Face Analysis: Buffalo_l model from InsightFace
- Generation Parameters:
- 512x768 resolution
- 100 inference steps
- Face strength: 2.1
- Likeness strength: 0.7
How It Works
- User uploads one or more face photos
- The system extracts facial embeddings using InsightFace
- If multiple photos are provided, it averages the embeddings
- The face is aligned and cropped for better results
- IP-Adapter integrates the facial features into the Stable Diffusion generation process
- The system generates a single portrait with the specified style while maintaining facial identity
Safety Features
- Includes negative prompts to prevent multiple people in generated images
- Ensures single person portraits only
- GPU acceleration via Spaces for faster processing
ํ๊ธ ์ค๋ช
๊ฐ์
MagicFace V3๋ IP-Adapter FaceID ๊ธฐ์ ๊ณผ Stable Diffusion์ ํ์ฉํ AI ๊ธฐ๋ฐ ์ผ๊ตด ๋ณํ ์ ํ๋ฆฌ์ผ์ด์ ์ ๋๋ค. ์ฌ์ฉ์๊ฐ ์ ๋ก๋ํ ์ฌ์ง์ ๋ค์ํ ์์ ์ ์คํ์ผ์ด๋ ๊ฐ์์ ์บ๋ฆญํฐ๋ก ๋ณํํ๋ฉด์๋ ์ผ๊ตด์ ์ ์ฒด์ฑ์ ์ ์งํฉ๋๋ค.
์ฃผ์ ๊ธฐ๋ฅ
- ์ผ๊ตด ์ ์ฒด์ฑ ๋ณด์กด: InsightFace๋ฅผ ์ฌ์ฉํ์ฌ ์ผ๊ตด์ ๊ฐ์งํ๊ณ ์๋ฒ ๋ฉ์ ์ถ์ถํ์ฌ ์์ฑ๋ ์ด๋ฏธ์ง๊ฐ ์ฌ์ฉ์์ ์ผ๊ตด ํน์ง์ ์ ์งํ๋๋ก ํฉ๋๋ค
- ๋ค์ค ์ด๋ฏธ์ง ์ง์: ๋์ผ์ธ์ ์ฌ๋ฌ ์ฌ์ง์ ์ฒ๋ฆฌํ์ฌ ๋ ๋์ ํ๊ท ํํ์ ์์ฑํ ์ ์์ต๋๋ค
- ์ฌ์ ์ค์ ์คํ์ผ: 10๊ฐ์ง ์ฌ์ ๊ตฌ์ฑ๋ ๋ณํ ์คํ์ผ ์ ๊ณต:
- ํด๋์ ์ํธ ์คํ์ผ (๋ชจ๋๋ฆฌ์, ๋ฐ ๊ณ ํ)
- ๊ฐ์ ์บ๋ฆญํฐ (์์ด์ธ ํ์ด๋ก, ์คํ์์ฆ ์ ๋ค์ด, ๋งคํธ๋ฆญ์ค ํ์ด๋ก)
- ์ญ์ฌ์ ์ธ๋ฌผ (์ด์งํธ ํ๋ผ์ค, ๊ทธ๋ฆฌ์ค ์ , ์ค์ธ ๊ธฐ์ฌ)
- ๋ชจํ ํ ๋ง (ํด์ ์ ์ฅ, ์ ๋ก ํ์ฆ)
- ์ฌ์ฉ์ ์ ์ ํ๋กฌํํธ: ์ฌ์ฉ์๊ฐ ์ํ๋ ๋ณํ ์ค๋ช ์ ์ง์ ์์ฑ ๊ฐ๋ฅ
- ์ฑ๋ณ ์ ํ: ์ ํ๋ ์ฑ๋ณ์ ๋ฐ๋ผ ์์ฑ ์ต์ ํ
๊ธฐ์ ์ ๊ตฌ์ฑ์์
- ๊ธฐ๋ณธ ๋ชจ๋ธ: Realistic_Vision_V4.0_noVAE
- IP-์ด๋ํฐ: ์ผ๊ตด ํน์ง ๋ณด์กด์ ์ํ FaceID ๋ฐ FaceID Plus ๋ชจ๋ธ
- ์ผ๊ตด ๋ถ์: InsightFace์ Buffalo_l ๋ชจ๋ธ
- ์์ฑ ๋งค๊ฐ๋ณ์:
- 512x768 ํด์๋
- 100 ์ถ๋ก ๋จ๊ณ
- ์ผ๊ตด ๊ฐ๋: 2.1
- ์ ์ฌ๋ ๊ฐ๋: 0.7
์๋ ๋ฐฉ์
- ์ฌ์ฉ์๊ฐ ํ ์ฅ ์ด์์ ์ผ๊ตด ์ฌ์ง์ ์ ๋ก๋
- ์์คํ ์ด InsightFace๋ฅผ ์ฌ์ฉํ์ฌ ์ผ๊ตด ์๋ฒ ๋ฉ ์ถ์ถ
- ์ฌ๋ฌ ์ฌ์ง์ด ์ ๊ณต๋ ๊ฒฝ์ฐ ์๋ฒ ๋ฉ์ ํ๊ท ๊ฐ ๊ณ์ฐ
- ๋ ๋์ ๊ฒฐ๊ณผ๋ฅผ ์ํด ์ผ๊ตด ์ ๋ ฌ ๋ฐ ํฌ๋กญ
- IP-Adapter๊ฐ ์ผ๊ตด ํน์ง์ Stable Diffusion ์์ฑ ํ๋ก์ธ์ค์ ํตํฉ
- ์ง์ ๋ ์คํ์ผ๋ก ์ผ๊ตด ์ ์ฒด์ฑ์ ์ ์งํ๋ฉด์ ๋จ์ผ ์ธ๋ฌผ ์ด์ํ ์์ฑ
์์ ๊ธฐ๋ฅ
- ์์ฑ๋ ์ด๋ฏธ์ง์ ์ฌ๋ฌ ์ฌ๋์ด ๋ํ๋๋ ๊ฒ์ ๋ฐฉ์งํ๋ ๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ ํฌํจ
- ๋จ์ผ ์ธ๋ฌผ ์ด์ํ๋ง ์์ฑ๋๋๋ก ๋ณด์ฅ
- ๋น ๋ฅธ ์ฒ๋ฆฌ๋ฅผ ์ํ Spaces GPU ๊ฐ์
์ด ์ ํ๋ฆฌ์ผ์ด์ ์ ์ฌ์ฉ์์ ์ผ๊ตด์ ๋ค์ํ ์์ ์ ์คํ์ผ๋ก ๋ณํํ๋ฉด์๋ ๋ณธ์ธ์ ์ผ๊ตด ํน์ง์ ์ ์งํ๋ ํ์ ์ ์ธ AI ๋๊ตฌ์ ๋๋ค.