primerz commited on
Commit
667cce7
ยท
verified ยท
1 Parent(s): ff176e8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +196 -5
README.md CHANGED
@@ -1,12 +1,203 @@
1
  ---
2
  title: Pixagram
3
- emoji: ๐ŸŒ
4
  colorFrom: purple
5
- colorTo: blue
6
- sdk: static
7
- pinned: false
 
 
8
  license: mit
9
  short_description: Transform any images including portrait into real pixel art!
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: Pixagram
3
+ emoji: ๐ŸŽฎ
4
  colorFrom: purple
5
+ colorTo: pink
6
+ sdk: gradio
7
+ sdk_version: 4.12.0
8
+ app_file: app.py
9
+ pinned: true
10
  license: mit
11
  short_description: Transform any images including portrait into real pixel art!
12
  ---
13
 
14
+ # ๐ŸŽฎ Pixagram Converter
15
+
16
+ Convert any image into stunning retro game art using advanced AI models!
17
+
18
+ ## Features
19
+
20
+ - **Custom SDXL Checkpoint**: Uses the "Horizon" model optimized for artistic generation
21
+ - **Pixelate VAE**: Custom VAE that creates authentic 8x pixelated retro aesthetic
22
+ - **RetroArt LORA**: Style-specific LORA for enhanced retro game art look
23
+ - **Face Preservation**: Automatically detects and preserves facial features using InstantID with Antelopev2
24
+ - **Depth-Aware**: Uses ControlNet Zoe Depth to maintain realistic depth in the output
25
+ - **Aspect Ratio Preservation**: Maintains the original image proportions
26
+
27
+ ## ๐Ÿค– Models
28
+
29
+ All custom models are loaded from the HuggingFace Hub repository: **[primerz/pixagram](https://huggingface.co/primerz/pixagram)**
30
+
31
+ - **horizon.safetensors**: Custom SDXL checkpoint (~7 GB)
32
+ - **retroart.safetensors**: RetroArt LORA (~50 MB)
33
+ - **pixelate.safetensors**: Pixelate VAE (~200 MB)
34
+
35
+ Models are automatically downloaded on first use and cached for subsequent runs.
36
+
37
+ ## ๐Ÿ“ Installation & Setup
38
+
39
+ ### Quick Deployment
40
+
41
+ This Space automatically loads models from the HuggingFace Hub repository **primerz/pixagram**.
42
+
43
+ **To deploy your own version:**
44
+
45
+ 1. **Create a new HuggingFace Space**
46
+ - Go to https://huggingface.co/new-space
47
+ - Choose Gradio SDK
48
+ - Select a GPU (T4 or better recommended)
49
+
50
+ 2. **Clone and upload files**
51
+ ```bash
52
+ git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
53
+ cd YOUR_SPACE_NAME
54
+
55
+ # Copy only these files:
56
+ # - app.py
57
+ # - requirements.txt
58
+ # - README.md
59
+
60
+ git add .
61
+ git commit -m "Initial commit"
62
+ git push
63
+ ```
64
+
65
+ 3. **Wait for build**
66
+ - The Space will automatically download models from primerz/pixagram
67
+ - First build may take 10-15 minutes
68
+ - Models are cached after first download
69
+
70
+ ### Using Your Own Models
71
+
72
+ If you want to use your own custom models:
73
+
74
+ 1. Create a HuggingFace model repository
75
+ 2. Upload your `.safetensors` files:
76
+ - `horizon.safetensors` (SDXL checkpoint)
77
+ - `retroart.safetensors` (LORA)
78
+ - `pixelate.safetensors` (VAE)
79
+ 3. Update `MODEL_REPO` in `app.py` to your repository name
80
+
81
+ ## ๐Ÿš€ Usage
82
+
83
+ ### Web Interface
84
+
85
+ Simply upload an image and click "Generate Retro Art"! The model will:
86
+ 1. Detect faces (if any) and preserve facial features
87
+ 2. Analyze depth information from the image
88
+ 3. Apply the retro art style
89
+ 4. Maintain aspect ratio while optimizing resolution
90
+
91
+ ### API Usage
92
+
93
+ The Space exposes a full API. Here's how to use it:
94
+
95
+ ```python
96
+ from gradio_client import Client
97
+
98
+ client = Client("YOUR_USERNAME/YOUR_SPACE_NAME")
99
+
100
+ result = client.predict(
101
+ image="path/to/your/image.jpg",
102
+ prompt="retro pixel art game, 16-bit style, vibrant colors",
103
+ negative_prompt="blurry, low quality, modern",
104
+ steps=30,
105
+ guidance_scale=7.5,
106
+ controlnet_scale=0.8,
107
+ lora_scale=0.85,
108
+ api_name="/predict"
109
+ )
110
+
111
+ print(result) # Path to output image
112
+ ```
113
+
114
+ ### API with cURL
115
+
116
+ ```bash
117
+ curl -X POST "https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/api/predict" \
118
+ -H "Content-Type: application/json" \
119
+ -d '{
120
+ "data": [
121
+ "base64_encoded_image_or_url",
122
+ "retro pixel art game, 16-bit style",
123
+ "blurry, low quality",
124
+ 30,
125
+ 7.5,
126
+ 0.8,
127
+ 0.85
128
+ ]
129
+ }'
130
+ ```
131
+
132
+ ## โš™๏ธ Parameters
133
+
134
+ - **Prompt**: Describe the retro style you want
135
+ - **Negative Prompt**: What to avoid in the generation
136
+ - **Inference Steps** (20-50): More steps = better quality but slower
137
+ - **Guidance Scale** (1-15): How closely to follow the prompt
138
+ - **ControlNet Scale** (0-2): Strength of depth preservation
139
+ - **LORA Scale** (0-2): Strength of RetroArt style application
140
+
141
+ ## ๐ŸŽจ Tips for Best Results
142
+
143
+ 1. **For Portraits**: The system automatically detects faces and enhances preservation
144
+ 2. **For Scenes**: Use prompts like "retro game background, pixel art environment"
145
+ 3. **For Characters**: Try "16-bit game character, sprite art, detailed"
146
+ 4. **Adjust LORA Scale**: Lower (0.5-0.7) for subtle effect, higher (0.9-1.2) for strong retro look
147
+
148
+ ## ๐Ÿ” Technical Details
149
+
150
+ - **Base Model**: SDXL with custom "Horizon" checkpoint from primerz/pixagram
151
+ - **Model Repository**: [primerz/pixagram](https://huggingface.co/primerz/pixagram)
152
+ - **Face Detection**: Antelopev2 (InsightFace)
153
+ - **Depth Estimation**: DPT-Hybrid-MIDAS
154
+ - **ControlNet**: Zoe Depth SDXL
155
+ - **VAE**: Custom 8x pixelation VAE
156
+ - **Optimization**: xformers, model offloading, VAE slicing
157
+
158
+ ### Fallback Behavior
159
+ If models cannot be downloaded from the Hub:
160
+ - **Checkpoint**: Falls back to `stabilityai/stable-diffusion-xl-base-1.0`
161
+ - **VAE**: Falls back to `madebyollin/sdxl-vae-fp16-fix`
162
+ - **LORA**: Runs without LORA (style will be less retro)
163
+
164
+ ## ๐Ÿ› Troubleshooting
165
+
166
+ ### "Model download failed"
167
+ - Check internet connectivity in Space settings
168
+ - Verify the model repository (primerz/pixagram) is public
169
+ - Check Space logs for specific error messages
170
+
171
+ ### Out of Memory
172
+ - Try reducing image resolution
173
+ - Lower inference steps
174
+ - Use a larger GPU (A10G or A100)
175
+
176
+ ### Slow Generation
177
+ - First generation is always slower (model downloading + loading)
178
+ - Consider using a faster GPU tier
179
+ - Reduce inference steps to 20-25
180
+
181
+ ### Models not loading
182
+ - Check Space logs for download errors
183
+ - Verify HuggingFace Hub access
184
+ - Ensure GPU is available
185
+
186
+ ## ๐Ÿ“„ License
187
+
188
+ MIT License - Feel free to use and modify!
189
+
190
+ ## ๐Ÿ™ Credits
191
+
192
+ - SDXL by Stability AI
193
+ - ControlNet by Lvmin Zhang
194
+ - InsightFace for face analysis
195
+ - Diffusers library by HuggingFace
196
+
197
+ ## ๐Ÿค Contributing
198
+
199
+ Issues and pull requests are welcome!
200
+
201
+ ---
202
+
203
+ **Note**: This Space requires a GPU. Free tier may experience queuing during high usage.