Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
45ddef4
1
Parent(s):
96b7653
examples
Browse files
README.md
CHANGED
@@ -10,4 +10,76 @@ pinned: true
|
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
+
# Chroma Image Generator
|
14 |
+
|
15 |
+
A Gradio app for generating images using the [Chroma](https://huggingface.co/lodestones/Chroma) model by [lodestones](https://huggingface.co/lodestones).
|
16 |
+
|
17 |
+
## Features
|
18 |
+
|
19 |
+
- **High-quality image generation** using the Chroma model
|
20 |
+
- **Customizable parameters**: width, height, steps, CFG scale, and seed
|
21 |
+
- **Pre-cached examples** for instant preview and testing
|
22 |
+
- **Professional UI** with Gradio interface
|
23 |
+
|
24 |
+
## Example Prompts
|
25 |
+
|
26 |
+
The app includes 11 pre-configured example prompts with optimized parameters:
|
27 |
+
|
28 |
+
1. **High-fashion portrait** with anaglyph 3D effect
|
29 |
+
2. **Young man** with captain's hat and sunglasses
|
30 |
+
3. **Shiba Inu** with captain's hat and sunglasses
|
31 |
+
4. **Impressionistic sailing painting**
|
32 |
+
5. **Anthro wolf** in forest setting
|
33 |
+
6. **Dragon with galaxy wings** over castle
|
34 |
+
7. **Anthro dog** in NYC apartment
|
35 |
+
8. **Leopard geckos collage**
|
36 |
+
9. **Anthro wolf plushie collage**
|
37 |
+
10. **Telegram sticker** anthro fox
|
38 |
+
11. **Tiger eye** with 'Chroma' text overlay
|
39 |
+
|
40 |
+
## Caching
|
41 |
+
|
42 |
+
The app uses Gradio's built-in `cache_examples=True` feature to pre-generate and cache all example images. This means:
|
43 |
+
|
44 |
+
- **Instant results** when clicking on examples
|
45 |
+
- **No waiting time** for cached examples
|
46 |
+
- **Automatic cache management** by Gradio
|
47 |
+
- **Faster user experience** for trying different prompts
|
48 |
+
|
49 |
+
## Usage
|
50 |
+
|
51 |
+
1. **Manual input**: Enter your own prompt and adjust parameters
|
52 |
+
2. **Use examples**: Click on any example to load it instantly
|
53 |
+
3. **Customize**: Modify example prompts to create variations
|
54 |
+
4. **Generate**: Click the Generate button to create new images
|
55 |
+
|
56 |
+
## Parameters
|
57 |
+
|
58 |
+
- **Prompt**: Describe what you want to generate
|
59 |
+
- **Negative Prompt**: Describe what you want to avoid
|
60 |
+
- **Width/Height**: Image dimensions (512-2048px)
|
61 |
+
- **Steps**: Number of denoising steps (1-50)
|
62 |
+
- **CFG Scale**: How closely to follow the prompt (1-20)
|
63 |
+
- **Seed**: Random seed for reproducible results (-1 for random)
|
64 |
+
|
65 |
+
## Technical Details
|
66 |
+
|
67 |
+
- Built with **Gradio** for the web interface
|
68 |
+
- Uses **ComfyUI** workflow backend
|
69 |
+
- Powered by **Chroma** diffusion model
|
70 |
+
- Supports **GPU acceleration** with Spaces
|
71 |
+
- **Automatic caching** for optimal performance
|
72 |
+
|
73 |
+
## Running Locally
|
74 |
+
|
75 |
+
```bash
|
76 |
+
python app.py
|
77 |
+
```
|
78 |
+
|
79 |
+
The app will start and be available at `http://localhost:7860`
|
80 |
+
|
81 |
+
## Cache Directory
|
82 |
+
|
83 |
+
Examples are cached in the `gradio_cached_examples` directory. To rebuild the cache (if examples change), delete this directory and restart the app.
|
84 |
+
|
85 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -15,6 +15,65 @@ t5_path = hf_hub_download(repo_id="comfyanonymous/flux_text_encoders", filename=
|
|
15 |
vae_path = hf_hub_download(repo_id="lodestones/Chroma", filename="ae.safetensors", local_dir="models/vae")
|
16 |
unet_path = hf_hub_download(repo_id="lodestones/Chroma", filename="chroma-unlocked-v31.safetensors", local_dir="models/unet")
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# Utility functions
|
19 |
def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
|
20 |
try:
|
@@ -251,6 +310,16 @@ Space Author: [GitHub](https://github.com/gokayfem) | [X.com](https://x.com/goka
|
|
251 |
inputs=[prompt, negative_prompt, width, height, steps, cfg, seed],
|
252 |
outputs=[output_image]
|
253 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
if __name__ == "__main__":
|
256 |
app.launch(share=True)
|
|
|
15 |
vae_path = hf_hub_download(repo_id="lodestones/Chroma", filename="ae.safetensors", local_dir="models/vae")
|
16 |
unet_path = hf_hub_download(repo_id="lodestones/Chroma", filename="chroma-unlocked-v31.safetensors", local_dir="models/unet")
|
17 |
|
18 |
+
# Example prompts with their parameters
|
19 |
+
EXAMPLES = [
|
20 |
+
[
|
21 |
+
"A high-fashion close-up portrait of a blonde woman in clear sunglasses. The image uses a bold teal and red color split for dramatic lighting. The background is a simple teal-green. The photo is sharp and well-composed, and is designed for viewing with anaglyph 3D glasses for optimal effect. It looks professionally done.",
|
22 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
23 |
+
1024, 1024, 36, 3.0, 229
|
24 |
+
],
|
25 |
+
[
|
26 |
+
"A young man smiles broadly while wearing a blue captain's hat and blue mirrored aviator sunglasses. The man is the sharp focus of the image, set against a nicely blurred waterfront background featuring boats and buildings. The shot is cheerful, playful, and amateur looking.",
|
27 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
28 |
+
1024, 1024, 40, 2.1, 424
|
29 |
+
],
|
30 |
+
[
|
31 |
+
"A Shiba Inu smiles broadly while wearing a blue captain's hat and blue mirrored aviator sunglasses. The dog is the sharp focus of the image, set against a nicely blurred waterfront background featuring boats and buildings. The shot is cheerful, playful, and amateur looking.",
|
32 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
33 |
+
1024, 1024, 28, 2.9, 413
|
34 |
+
],
|
35 |
+
[
|
36 |
+
"A painting shows a bearded man in a beige shirt gripping a rope on a sailboat, battling choppy seas under a dramatic sunset. Another figure appears in the distant background, and the style is impressionistic with clear brushstrokes and high skill. The overall effect is one of adventure and freedom.",
|
37 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
38 |
+
1024, 1024, 33, 4.6, 281
|
39 |
+
],
|
40 |
+
[
|
41 |
+
"A painting shows an anthro male wolf sitting on a rock in a forest, anthro, male, solo, canine, canid, werewolf, muscular anthro, black body, black fur, reaching at viewer with his paws, detailed background, outdoors, outside. The scene is detailed, with a shallow depth of field focusing on the anthro wolf. The overall effect is high fantasy and cinematic.",
|
42 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
43 |
+
1024, 1024, 26, 3.8, 326
|
44 |
+
],
|
45 |
+
[
|
46 |
+
"A cute cartoon illustration of A massive black dragon with cosmic galaxy-patterned wings sits atop a castle overlooking a medieval port town at sunset. The style is bright and pastel-toned with soft lines. The artwork is clean and fairly well-executed.",
|
47 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
48 |
+
1024, 1024, 41, 5.7, 244
|
49 |
+
],
|
50 |
+
[
|
51 |
+
"A soft longhaired male anthro dog, with a white chest patch and bright yellow-green eyes, sits on a light grey kitchen island in a sun-drenched NYC apartment. The city view is blurred, showcasing a shallow depth of field. The cat has a dark collar with a small bell. The photo's aesthetic is clean, modern, and slightly dramatic due to the lighting.",
|
52 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
53 |
+
1024, 1024, 26, 4.7, 242
|
54 |
+
],
|
55 |
+
[
|
56 |
+
"A cheerful collage showcases 4 individual leopard geckos, each in a separate square. The geckos vary in color and pattern, but all are shown close-up and looking directly at the camera. Backgrounds differ, illustrating various terrarium elements and simple surfaces. High-quality shots, bright lighting, amateur photo quality. The overall aesthetic is heartwarming and simple.",
|
57 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
58 |
+
1024, 1024, 26, 4.7, 249
|
59 |
+
],
|
60 |
+
[
|
61 |
+
"A cheerful collage showcases 4 cute anthro wolf nick wilde plushie, each in a separate square. Backgrounds differ, illustrating various bed and simple surfaces. High-quality shots, bright lighting, amateur photo quality. The overall aesthetic is heartwarming and simple.",
|
62 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
63 |
+
1024, 1024, 26, 5.4, 263
|
64 |
+
],
|
65 |
+
[
|
66 |
+
"this picture depics a telegram sticker with thick white outlines of a male anthro fox",
|
67 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
68 |
+
1024, 1024, 28, 3.9, 399
|
69 |
+
],
|
70 |
+
[
|
71 |
+
"Extreme close-up of a single tiger eye, direct frontal view. Detailed iris and pupil. Sharp focus on eye texture and color. Natural lighting to capture authentic eye shine and depth. The word \"Chroma\" is painted over it in big, white brush strokes with visible texture.",
|
72 |
+
"low quality, ugly, unfinished, out of focus, deformed, disfigure, blurry, smudged, restricted palette, flat colors",
|
73 |
+
1024, 1024, 26, 4.0, 9
|
74 |
+
]
|
75 |
+
]
|
76 |
+
|
77 |
# Utility functions
|
78 |
def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
|
79 |
try:
|
|
|
310 |
inputs=[prompt, negative_prompt, width, height, steps, cfg, seed],
|
311 |
outputs=[output_image]
|
312 |
)
|
313 |
+
|
314 |
+
# Add examples section
|
315 |
+
gr.Examples(
|
316 |
+
examples=EXAMPLES,
|
317 |
+
inputs=[prompt, negative_prompt, width, height, steps, cfg, seed],
|
318 |
+
outputs=[output_image],
|
319 |
+
fn=generate_image,
|
320 |
+
cache_examples=True,
|
321 |
+
label="Example Prompts - Click to try!"
|
322 |
+
)
|
323 |
|
324 |
if __name__ == "__main__":
|
325 |
app.launch(share=True)
|