Spaces:
Running
on
Zero
Running
on
Zero
File size: 8,799 Bytes
47de5be 2d0bc0b 47de5be 2d0bc0b 78d88fa 47de5be 78d88fa 47de5be 78d88fa 47de5be 78d88fa 47de5be 78d88fa a21161b 47de5be 78d88fa 47de5be 09f5952 47de5be |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
"""
presets.py - Batch Generation Presets for Qwen Image Editor
Predefined prompt templates that enable batch generation
of images with common variations. Each preset defines a set of related prompts
that can be automatically applied to a base instruction to create multiple
diverse outputs.
Structure:
Each preset contains:
- 'count': Number of images to generate (1-4 depending on the preset and requirements)
- 'prompts': List of template strings to append to the base prompt
- 'description': Human-readable description shown in the UI
Example:
Base prompt: "a red car"
Multiview preset generates:
1. "a red car, frontal view of the subject, facing camera directly"
2. "a red car, left side view of subject, profile view from the left side"
3. "a red car, right side view of subject, profile view from the right side"
4. "a red car, back side view of subject, showing the rear/back view"
Borderless R&D
"""
PRESETS = {
"Multiview": {
"count": 3,
"prompts": [
"frontal view of the subject, facing camera directly",
"side view of subject, profile view from the side",
"dutch angle shot of subject, candid photography"
],
"description": "Generate three different views of the subject"
},
"Style Variations": {
"count": 3,
"prompts": [
"in realistic photography style, high detail",
"in cartoon/anime style, vibrant colors",
"in sketch drawing style, black and white outline"
],
"description": "Apply different artistic styles to the subject"
},
"Lighting Conditions": {
"count": 3,
"prompts": [
"in bright daylight, clear sunny conditions",
"in golden hour lighting, warm sunset glow",
"in studio lighting, professional portrait setup"
],
"description": "Render the subject under different lighting"
},
"Quick Hairstyles": {
"count": 3,
"prompts": [
"with long straight dark hair",
"with short blonde combover",
"with brunette hair tied up into updo style"
],
"description": "Show the subject in different hairstyles"
},
"Seasonal Themes": {
"count": 4,
"prompts": [
"in a snowy winter landscape, snowflakes falling gently",
"in a sunny summer meadow, bright sunshine",
"in a crisp autumn forest, leaves turning orange",
"in a misty spring garden, blooming flowers"
],
"description": "Render the subject in each of the four seasons"
},
"Emotional Mood": {
"count": 4,
"prompts": [
"with a joyful grin, eyes sparkling",
"with a thoughtful expression, slightly furrowed brow",
"with a dramatic, intense stare",
"with a gentle, serene smile"
],
"description": "Show the subject’s emotions in four different moods"
},
"Historical Eras": {
"count": 4,
"prompts": [
"in Victorian England, ornate lace and corset",
"in the 1980s, neon lights and big hair",
"in a medieval castle, knight armor",
"in a futuristic cyber‑punk city, holographic backdrop"
],
"description": "Place the subject in four iconic time periods"
},
"Camera Lens Effects": {
"count": 4,
"prompts": [
"captured with a wide‑angle lens, exaggerated perspective",
"shot with a telephoto lens, shallow depth of field",
"taken with a fisheye lens, circular distortion",
"rendered with a macro lens, extreme close‑up detail"
],
"description": "Play with different lens styles for the same subject"
},
"Fantasy Elements": {
"count": 3,
"prompts": [
"surrounded by a swirling vortex of light",
"hovering above a floating island in the clouds",
"paired with a companion dragon, breathing fire",
],
"description": "Add a fantastical twist to each rendition"
},
"Texture Variations": {
"count": 3,
"prompts": [
"covered in soft velvet, plush texture",
"painted with glossy enamel, shiny finish",
"wrapped in intricate lace patterns",
],
"description": "Show the subject in three distinct surface textures"
},
"Color Palette Swaps": {
"count": 3,
"prompts": [
"in pastel colors, soft hues",
"with neon saturation, high‑contrast glow",
"in monochrome black & white, dramatic contrast"
],
"description": "Recolor the subject with three distinct palettes"
},
"Runway Catwalk": {
"count": 4,
"prompts": [
"strutting down a glossy runway, spotlight on the model",
"walking confidently with a high‑fashion backdrop",
"posing with a dramatic, angular pose on the catwalk",
"showcasing an avant‑garde ensemble, dramatic lighting"
],
"description": "Capture the model on a high‑end runway"
},
"Vogue Editorial": {
"count": 3,
"prompts": [
"editorial shot with a moody, artistic background",
"intimate close‑up, dramatic lighting and subtle shadows",
"wide‑angle full‑body shot, striking composition"
],
"description": "Create a magazine‑quality editorial spread"
},
"Evening Gown Glam": {
"count": 3,
"prompts": [
"floor‑length ballroom gown, shimmering crystal embellishments",
"gold‑en, reflective lighting, chandelier backdrop",
"soft, ethereal glow, elegant pose"
],
"description": "Render an elegant evening dress in glamorous lighting"
},
"Chic Streetwear": {
"count": 4,
"prompts": [
"urban street backdrop, high‑contrast graffiti walls",
"modern athleisure look, bold colors and textures",
"casual, relaxed pose with a casual jacket and sneakers",
"dynamic movement shot, capturing fluidity"
],
"description": "Showcase the model in trendy street‑style attire"
},
"Swimwear Showcase": {
"count": 4,
"prompts": [
"wearing a vibrant neon bikini, sunny beach background",
"in a sleek one‑piece with high‑waisted cut, poolside setting",
"sporty swim trunks and matching tank top, surfing wave backdrop",
"coastal vibe with a chic cover‑up over a solid‑color swimsuit"
],
"description": "Highlight the model in four distinct swimwear styles, from bold bikinis to elegant one‑pieces and sporty swimwear"
},
"Polaroid and Film": {
"count": 4,
"prompts": [
"captured in a vintage Polaroid frame, sepia‑tone filter, soft vignette",
"black‑and‑white film shot with a slight grain, high‑contrast lighting",
"soft focus, pastel color palette with a subtle yellow tint, nostalgic feel",
"classic instant camera style, square format, warm lighting, subtle bokeh"
],
"description": "Generate a nostalgic Polaroid/film aesthetic across four different looks"
}
}
def get_preset_choices():
"""
Return list of preset choices for Gradio dropdown.
Returns:
list: [None] + list of preset names for dropdown selection
"""
return [None] + list(PRESETS.keys())
def get_preset_info(preset_name):
"""
Get preset configuration by name.
Args:
preset_name (str): Name of the preset to retrieve
Returns:
dict or None: Preset configuration dictionary or None if not found
"""
return PRESETS.get(preset_name, None)
def update_preset_prompt(preset_name, prompt_index, new_prompt):
"""
Update a specific prompt in a preset.
Args:
preset_name (str): Name of the preset to update
prompt_index (int): Index of the prompt to update (0-3)
new_prompt (str): New prompt text
Returns:
dict: Updated PRESETS dictionary
"""
if preset_name in PRESETS and 0 <= prompt_index < len(PRESETS[preset_name]["prompts"]):
PRESETS[preset_name]["prompts"][prompt_index] = new_prompt
return PRESETS[preset_name] if preset_name in PRESETS else None
# To add presets at runtime:
# PRESETS["New Preset Name"] = {
# "count": 2,
# "prompts": ["variation 1", "variation 2"],
# "description": "Description of new preset"
# } |