""" 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" # }