Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
#2
by
linoyts
HF Staff
- opened
app.py
CHANGED
|
@@ -3,54 +3,66 @@ import numpy as np
|
|
| 3 |
import random
|
| 4 |
import torch
|
| 5 |
import spaces
|
| 6 |
-
import
|
|
|
|
| 7 |
from PIL import Image
|
| 8 |
-
from diffusers import QwenImagePipeline
|
| 9 |
from qwenimage.qwen_fa3_processor import QwenDoubleStreamAttnProcessorFA3
|
| 10 |
from optimization import optimize_pipeline_
|
| 11 |
-
import os
|
| 12 |
|
| 13 |
-
from huggingface_hub import login
|
| 14 |
login(token=os.environ.get('hf'))
|
| 15 |
|
| 16 |
-
def api(prompt, model, kwargs={}):
|
| 17 |
-
import dashscope
|
| 18 |
-
api_key = os.environ.get('DASH_API_KEY')
|
| 19 |
-
if not api_key:
|
| 20 |
-
raise EnvironmentError("DASH_API_KEY is not set")
|
| 21 |
-
assert model in ["qwen-plus", "qwen-max", "qwen-plus-latest", "qwen-max-latest"], f"Not implemented model {model}"
|
| 22 |
-
messages = [
|
| 23 |
-
{'role': 'system', 'content': 'You are a helpful assistant.'},
|
| 24 |
-
{'role': 'user', 'content': prompt}
|
| 25 |
-
]
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
api_key=api_key,
|
| 31 |
-
|
| 32 |
-
messages=messages,
|
| 33 |
-
result_format='message',
|
| 34 |
-
response_format=response_format,
|
| 35 |
-
)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
def get_caption_language(prompt):
|
|
|
|
| 44 |
ranges = [
|
| 45 |
('\u4e00', '\u9fff'), # CJK Unified Ideographs
|
| 46 |
-
# ('\u3400', '\u4dbf'), # CJK Unified Ideographs Extension A
|
| 47 |
-
# ('\u20000', '\u2a6df'), # CJK Unified Ideographs Extension B
|
| 48 |
]
|
| 49 |
for char in prompt:
|
| 50 |
if any(start <= char <= end for start, end in ranges):
|
| 51 |
return 'zh'
|
| 52 |
return 'en'
|
| 53 |
|
|
|
|
| 54 |
def polish_prompt_en(original_prompt):
|
| 55 |
SYSTEM_PROMPT = '''
|
| 56 |
# Image Prompt Rewriting Expert
|
|
@@ -72,7 +84,7 @@ Your task is to automatically classify the user's original image description int
|
|
| 72 |
3. **Never modify proper nouns**: Names of people, brands, locations, IPs, movie/game titles, slogans in their original wording, URLs, phone numbers, etc., must be preserved exactly as given.
|
| 73 |
4. **Fully represent all textual content**:
|
| 74 |
- If the image contains visible text, **enclose every piece of displayed text in English double quotation marks (" ")** to distinguish it from other content.
|
| 75 |
-
- Accurately describe the text
|
| 76 |
- If the prompt implies the presence of specific text or numbers (even indirectly), explicitly state the **exact textual/numeric content**, enclosed in double quotation marks. Avoid vague references like "a list" or "a roster"; instead, provide concrete examples without excessive length.
|
| 77 |
- If no text appears in the image, explicitly state: "The image contains no recognizable text."
|
| 78 |
5. **Clearly specify the overall artistic style**, such as realistic photography, anime illustration, movie poster, cyberpunk concept art, watercolor painting, 3D rendering, game CG, etc.
|
|
@@ -92,7 +104,7 @@ When the image centers on a human subject, or if the prompt uses terms like 'por
|
|
| 92 |
- Clothing: specify all garments, including tops, bottoms, footwear, one-piece outfits, and outerwear. Note their type (e.g., silk blouse, denim jeans, leather boots, knit dress, wool overcoat) and fabric texture.
|
| 93 |
- Hairstyle: describe the hair color, length, texture, and style. For color, specify the shade (e.g., jet black, platinum blonde, auburn red). For style, describe the cut and arrangement (e.g., long and straight, curly with bangs, a center-parted bob).
|
| 94 |
- Accessories: list any additional items such as headwear, jewelry (earrings, necklaces, rings), glasses, etc.
|
| 95 |
-
3. **Capture Pose and Action**: Articulate the subject
|
| 96 |
- Body Posture: describe the overall stance or position (e.g., leaning casually against a wall, sitting upright with perfect posture, in mid-stride while walking).
|
| 97 |
- Gaze & Head Position: specify the direction of the subject's gaze (e.g., looking directly into the camera, gazing off-frame to the left, looking down at an object) and the tilt of the head (e.g., tilted slightly, held high).
|
| 98 |
- Hand & Arm Gestures: detail the placement and action of the hands and arms (e.g., one hand gently resting on the chin, arms crossed confidently over the chest, hands tucked into pockets, gesturing mid-conversation).
|
|
@@ -109,11 +121,11 @@ When the image centers on a human subject, or if the prompt uses terms like 'por
|
|
| 109 |
"An East Asian male, approximately 25-35 years old, sits poised on a sleek white modern chair. He wears a tailored black blazer over a black crew-neck top, complemented by a silver chain necklace featuring a red heart-shaped pendant. His left ear is adorned with a small gold stud earring, and his left wrist bears a red cord bracelet with a matching heart charm. His hairstyle is short, black, and textured with volume, framing a clean, oval face with smooth, fair skin. His expression is calm and focused, gazing directly into the camera with neutral makeup enhancing his natural features — defined brows, subtle eyeliner, and soft pink lips. The background is a gradient of deep gray to black, accented by a minimalist light gray geometric structure to the right. Lighting is soft and diffused, highlighting his facial contours and attire without harsh shadows, creating a polished, high-fashion studio aesthetic. The image contains no recognizable text."
|
| 110 |
"A young woman of Caucasian ethnicity, likely in her 20s, stands outdoors on a sunlit city sidewalk. She has long, wavy brown hair cascading over her shoulders, fair skin with a soft matte finish, and subtle makeup featuring defined eyebrows, natural eyeliner, and soft red lipstick. Her expression is gentle and confident, with a slight smile. She wears a pale pink ribbed turtleneck sweater under a sleeveless navy blue knee-length dress with clean lines and a smooth texture. In her right hand, she lightly touches her hair near her temple; her left hand holds a matching pale pink leather clutch. The background features tall urban buildings with reflective glass facades, blurred pedestrians, and a yellow taxi partially visible on the right. Sunlight casts warm highlights on her hair and skin, creating a bright, airy atmosphere. The image contains no recognizable text."
|
| 111 |
"A South Asian bride, aged 20-30, wears a luxurious red and gold traditional wedding outfit with intricate embroidery. Her head is adorned with a maang tikka featuring gold beads and red gemstones, and a sheer veil edged with golden pearls. Her makeup is elegant and bold: deep brown smoky eyeshadow, voluminous curled lashes, sharply defined brows, and rich red lipstick. Her fair skin glows under soft highlighter. Both hands are decorated with elaborate reddish-brown henna patterns; her right ring finger bears a round gold ring with a central pearl. She wears multiple ornate gold bangles on each wrist and a small gold nose ring. Her dark hair is neatly styled beneath the headpiece. She gently rests her chin on her clasped hands in a poised posture. Traditional gold earrings dangle from her ears. The background features blurred crimson drapes and green festive garlands, bathed in warm, bright lighting that enhances the solemn yet celebratory wedding atmosphere. The image contains no recognizable text."
|
| 112 |
-
"A striking young adult woman of mixed or Latinx heritage with rich dark brown skin and glossy, wet-look black hair pulled into a severe, sleek high ponytail. Her facial features are sharp and defined: brows precisely shaped, eyes subtly enhanced with matte neutral eyeshadow, and lips in soft natural pink. She wears contrasting high-end earrings — one a diamond-encrusted silver knot with teardrop pendant, the other a single pearl on a diamond-studded hook. She is draped in a luxurious white shawl with fine fringe texture over a shimmering silver sleeveless V-neck top. The background is softly blurred, revealing only the faint silhouette of another person
|
| 113 |
"A young East Asian baby with short dark hair and fair skin sits cross-legged on a textured beige woven mat, wearing a fluffy blue fleece onesie with a front zipper and hood. The baby holds a small red wooden cube in its right hand, with wide, curious eyes and slightly parted lips. Surrounding the baby are scattered colorful wooden geometric blocks—green cylinders, yellow triangles, blue cubes, and red prisms—on the mat. Behind the baby, three white plastic storage drawers are stacked vertically against a light beige wall. The lighting is soft and natural, suggesting indoor daylight, creating a warm, calm atmosphere. The image contains no recognizable text."
|
| 114 |
"A curious East Asian toddler, approximately 1–2 years old, with short dark hair and fair skin, sits cross-legged on a soft beige textured carpet. The child wears a light green and white short-sleeve onesie decorated with colorful floral patterns and whimsical cartoon animals. Holding a magnifying glass with a gleaming golden frame and wooden handle in both hands, the toddler gazes intently toward the right edge of the frame, displaying focused curiosity. Behind them, a rustic wooden cabinet with two drawers and metal handles is softly blurred in the background. Warm, diffused natural daylight streams from a window on the left, illuminating the scene and creating a serene, tranquil atmosphere that emphasizes innocence and quiet discovery. The image contains no recognizable text."
|
| 115 |
"A warm, intimate outdoor scene captures a couple embracing. The man, seen from behind, has short dark curly hair and wears a light blue denim jacket. The woman, facing the camera, has long dark hair with a red polka-dotted headband, bright red lipstick, and a joyful smile showing affection. Her arms wrap around his shoulders; her left hand displays a simple silver ring. Soft golden-hour lighting bathes the green park background, creating a dreamy bokeh effect. The composition is a medium close-up shot with shallow depth of field, emphasizing emotional connection and tenderness. The image contains no recognizable text."
|
| 116 |
-
"An adult, visible only from the torso and arms, gently yet firmly holds a one-year-old East Asian baby girl. The infant has glossy black hair tied in a small ponytail, adorned with a light gray bow clip. Her round face features large, clear eyes gazing calmly to the right of the frame; her skin is fair and unadorned. She wears a soft cream-colored long-sleeve onesie printed with green botanicals and colorful flowers. The adult wears a textured beige cotton long-sleeve shirt, arms securely cradling the baby
|
| 117 |
"An elderly woman of likely Southeast Asian ethnic minority heritage, with deeply wrinkled skin and a warm, gentle smile, gazes directly at the camera. Her dark, thin hair is partially visible beneath a large, black triangular velvet headdress showing frayed edges. She has a round face with prominent cheekbones, dark eyes, and natural features without makeup. She wears a black garment with vibrant blue woven trim along the collar and a silver rectangular brooch fastened at the throat. Long, colorful beaded earrings — featuring red, blue, green, yellow, white, and brown beads with tassels — dangle from her ears. The background is softly blurred, suggesting an indoor or shaded environment with soft, directional natural lighting that accentuates the texture of her skin and garments. The image contains no recognizable text."
|
| 118 |
|
| 119 |
---
|
|
@@ -152,11 +164,11 @@ When the image contains recognizable text, please ensure the following:
|
|
| 152 |
"The image is titled 'LUXURY CRUISES: The Pinnacle of Ocean Travel & Indulgence' in large, gold and white text at the top against a dark blue background. Below this title, the image is divided into four quadrants surrounding a central circular illustration of a luxury cruise ship sailing through turquoise waters with green islands and a sunset in the background.\n\nTop left quadrant: Headed by 'SPACIOUS, ALL-SUITE ACCOMMODATIONS' in bold black text on a cream banner. It depicts a luxurious suite with a king bed, sofa, marble bathtub, and ocean-view balcony. Below the image, text reads: 'Generously sized suites, many with verandas. Dedicated butler service and premium amenities. A private sanctuary.'\n\nTop right quadrant: Headed by 'EXQUISITE CULINARY JOURNEYS' in bold black text on a cream banner. It shows an elegant dining setting with a gourmet seafood dish (lobster and scallops) on a plate, a glass of red wine, and a table set for two overlooking the sea. Below the image, text reads: 'Gourmet, open-seating dining. Multiple specialty venues. Premium beverages and fine wines typically included.'\n\nBottom left quadrant: Headed by 'UNRIVALED PERSONALIZED SERVICE' in bold black text on a cream banner. It illustrates crew members in uniform attending to guests relaxing on deck chairs, one serving towels and another polishing railings. Intimate, uncrowded environment with refined enrichment programs.'\n\nBottom right quadrant: Headed by 'EXCLUSIVE & IMMERSIVE DESTINATIONS' in bold black text on a cream banner. It features a small motorized tender boat approaching a secluded beach with palm trees and ancient ruins in the background. Below the image, text reads: 'EXCLUSIVE & IMMERSIVE DESTINATIONS Access to smaller, less crowded ports. Curated, culturally rich shore excursions. Explore remote corners of the globe.'\n\nAt the very bottom, centered on the dark blue background, is the tagline: 'An elevated experience of comfort, discovery, and seamless elegance.' No other text appears in the image."
|
| 153 |
"A composite promotional banner set featuring five distinct designs. Top banner: a young Caucasian woman with red hair, wearing a bright yellow beret and burgundy coat, poses thoughtfully in a mystical blue forest with glowing mushrooms; text reads \"探秘童话秘境, 限时特惠!\" (top left, white bold font). Middle banner: grayscale image of hands holding an old leather-bound book; text says \"沉浸知识海洋, 全场五折起!\" (left side, beige serif font). Bottom row: left panel shows silhouettes of deer, owls, and fox against sunset with text \"自然之声, 野趣生活.\" (white sans-serif); center panel displays colorful paper planes flying over clouds and gears with clock, text \"创意无限, 飞向未来.\" (blue background, white font); right panel features ornate mechanical clock surrounded by flowers with text \"时间艺术, 永恒珍藏.\" (brown background, dark brown font). All banners use vibrant color contrasts and symbolic imagery for marketing purposes. No other text appears in the image"
|
| 154 |
"The image displays a presentation slide titled 'Workshop Models in Creative Writing: Advantages & Challenges'. The slide is divided into two main sections: 'ADVANTAGES' on the left with a green header and checkmark icons, and 'CHALLENGES' on the right with a red header and cross icons. At the bottom, there is a conclusion line.\n\nUnder 'ADVANTAGES':\n- 'Peer Feedback & Diverse Perspectives (Collaborative Learning, Audience Awareness)'\n- 'Skill Development (Critical Analysis, Editing Practice, Voice Finding)'\n- 'Community Building (Supportive Environment, Reduced Isolation)'\n\nUnder 'CHALLENGES':\n- 'Variable Quality of Feedback (Vague, Biased, or Unhelpful Comments)'\n- 'Emotional & Vulnerability Toll (Defensiveness, Discouragement, Anxiety)'\n- 'Time Constraints & Balancing Acts (Limited Focus per Piece, Critique vs. Writing Time)'\n\nAt the bottom center: 'Conclusion: Fostering Growth while Navigating Hurdles'. No other text appears in the image."
|
| 155 |
-
"This is a movie poster. The upper right corner features the text
|
| 156 |
-
"In the upper left corner of the image are the large white characters
|
| 157 |
-
"At the top of the poster, the white text
|
| 158 |
-
"This is a six-panel cartoon comic about a subway's emergency response procedures. In the largest panel in the upper left, an anthropomorphic subway train smiles and points to the right. Above it, a speech bubble contains the text
|
| 159 |
-
"The image features a tech-inspired background with a deep blue color scheme. The left side is adorned with dynamic, flowing visual effects, including curved lines and light dots composed of blue and purple light. Thin, glowing curves and circular light spots of varying sizes, with colors graduating from light blue to purplish-pink, are distributed from the upper left to the left edge. In the middle of the left side, the characters
|
| 160 |
---
|
| 161 |
|
| 162 |
## Subtask 3: General Image Rewriting
|
|
@@ -180,27 +192,17 @@ When the image lacks human subjects or text, or primarily features landscapes, s
|
|
| 180 |
**Example Output**:
|
| 181 |
"A rugged mountain landscape under a clear blue sky with scattered white clouds. Snow-capped peaks dominate the background, with steep rocky slopes and visible glaciers. In the foreground, a rocky trail with scattered boulders and dry golden grass leads toward the mountains. Two red wooden trail markers stand on the right side of the path, one pointing left and the other pointing right; neither contains any visible text or inscriptions. No people, animals, or man-made structures beyond the trail markers are present. The lighting suggests midday sun, casting sharp shadows and highlighting textures in the rocks and snow.The image contains no recognizable text."
|
| 182 |
"A fluffy white and light gray cat with large green eyes and a small pink nose is lying down on a white surface. The cat is wearing a plush white bunny ear headband with pink inner ear linings. Its posture is relaxed, front paws tucked under its chest, whiskers visible, and gaze directed forward. The background is plain white, creating a clean, bright studio lighting effect with soft shadows. The image contains no recognizable text."
|
| 183 |
-
"A black-and-white close-up portrait of a fluffy white Persian cat with long fur, slightly squinted eyes, and prominent whiskers. The cat
|
| 184 |
-
"An adult tiger and a tiger cub are positioned near a small body of water surrounded by green grass and scattered rocks. The adult tiger, with orange fur, black stripes, and white underbelly, is lying down on the grass, facing left with its head turned slightly toward the cub. Its whiskers are long and white, and its expression appears calm and watchful. The tiger cub, smaller in size with similar striped markings but fluffier fur, is standing on a rocky edge near the water, one paw extended forward as if stepping or testing the surface. The cub
|
| 185 |
"A lemur with striking black-and-white facial markings and bright orange-yellow limbs clings to a tree trunk in a forest setting. Its large brown eyes are wide open, mouth slightly agape showing pink tongue, giving it an expressive, curious look. The fur is fluffy, with white around the face and gray on the body. The background shows tall trees with green leaves against a clear blue sky, suggesting daytime in a natural habitat. No text is visible in the image."
|
| 186 |
|
| 187 |
---
|
| 188 |
|
| 189 |
-
Based on the user
|
| 190 |
'''
|
| 191 |
original_prompt = original_prompt.strip()
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
success=False
|
| 195 |
-
while not success:
|
| 196 |
-
try:
|
| 197 |
-
polished_prompt = api(prompt, model='qwen-plus')
|
| 198 |
-
polished_prompt = polished_prompt.strip()
|
| 199 |
-
polished_prompt = polished_prompt.replace("\n", " ")
|
| 200 |
-
success = True
|
| 201 |
-
except Exception as e:
|
| 202 |
-
print(f"Error during API call: {e}")
|
| 203 |
-
return polished_prompt
|
| 204 |
|
| 205 |
def polish_prompt_zh(original_prompt):
|
| 206 |
SYSTEM_PROMPT = '''
|
|
@@ -222,8 +224,8 @@ def polish_prompt_zh(original_prompt):
|
|
| 222 |
4. **完整呈现所有文字信息**:
|
| 223 |
- 若图像包含文字,**图像中显示的文字内容均使用中文双引号包含起来**,以便与其他内容区分。
|
| 224 |
- 若图像包含文字,须准确描述其内容、位置、排版方向(横排/竖排/换行)、字体风格、颜色、大小及呈现方式(如印刷、刺绣、霓虹灯等);
|
| 225 |
-
-
|
| 226 |
-
-
|
| 227 |
5. **明确指定整体艺术风格**,例如:写实摄影、动漫插画、电影海报、赛博朋克概念图、水彩手绘、3D 渲染、游戏 CG 等。
|
| 228 |
|
| 229 |
---
|
|
@@ -241,9 +243,9 @@ def polish_prompt_zh(original_prompt):
|
|
| 241 |
7. **内容篇幅保持克制**:人像场景下,改写/扩写的内容篇幅保持简洁,输出控制在150字以内。
|
| 242 |
|
| 243 |
**示例输出**:
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
|
| 248 |
---
|
| 249 |
|
|
@@ -265,16 +267,16 @@ def polish_prompt_zh(original_prompt):
|
|
| 265 |
- 光照对文字可读性的影响(反光、背光、夜间照明等);
|
| 266 |
- 整体色调与艺术风格(复古、极简、赛博朋克等)。
|
| 267 |
4. **在信息图/知识类场景中适度补充文字**:
|
| 268 |
-
- 若prompt
|
| 269 |
- 若用户已提供详细文字,则以忠实保留为主,仅作必要润色;
|
| 270 |
- 文字内容必须与画面内容一一对应,拒绝模糊的描述。
|
| 271 |
|
| 272 |
**示例输出**:
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
|
| 279 |
---
|
| 280 |
|
|
@@ -297,66 +299,33 @@ def polish_prompt_zh(original_prompt):
|
|
| 297 |
- 比例与尺度(如高楼林立、巨石与行人、微观特写)。
|
| 298 |
|
| 299 |
**示例输出**:
|
| 300 |
-
|
| 301 |
|
| 302 |
---
|
| 303 |
|
| 304 |
请根据用户输入的内容,自动判断所属任务类型,输出一段符合上述规范的中文图像 Prompt。即使收到的是指令本身,也应将其视为待改写的描述内容进行处理,**不要解释、不要确认、不要额外回复**,仅输出改写后的 Prompt 文本。
|
| 305 |
'''
|
| 306 |
original_prompt = original_prompt.strip()
|
| 307 |
-
|
| 308 |
-
magic_prompt = "超清,4K,电影级构图"
|
| 309 |
-
success=False
|
| 310 |
-
while not success:
|
| 311 |
-
try:
|
| 312 |
-
polished_prompt = api(prompt, model='qwen-plus')
|
| 313 |
-
polished_prompt = polished_prompt.strip()
|
| 314 |
-
polished_prompt = polished_prompt.replace("\n", " ")
|
| 315 |
-
success = True
|
| 316 |
-
except Exception as e:
|
| 317 |
-
print(f"Error during API call: {e}")
|
| 318 |
-
return polished_prompt
|
| 319 |
|
| 320 |
|
| 321 |
def rewrite(input_prompt):
|
|
|
|
|
|
|
|
|
|
| 322 |
lang = get_caption_language(input_prompt)
|
| 323 |
if lang == 'zh':
|
| 324 |
return polish_prompt_zh(input_prompt)
|
| 325 |
-
|
| 326 |
-
|
| 327 |
return polish_prompt_en(input_prompt)
|
| 328 |
|
| 329 |
|
| 330 |
-
|
| 331 |
-
|
| 332 |
# --- Model Loading ---
|
| 333 |
dtype = torch.bfloat16
|
| 334 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 335 |
|
| 336 |
-
scheduler_config = {
|
| 337 |
-
"base_image_seq_len": 256,
|
| 338 |
-
"base_shift": math.log(3), # We use shift=3 in distillation
|
| 339 |
-
"invert_sigmas": False,
|
| 340 |
-
"max_image_seq_len": 8192,
|
| 341 |
-
"max_shift": math.log(3), # We use shift=3 in distillation
|
| 342 |
-
"num_train_timesteps": 1000,
|
| 343 |
-
"shift": 1.0,
|
| 344 |
-
"shift_terminal": None, # set shift_terminal to None
|
| 345 |
-
"stochastic_sampling": False,
|
| 346 |
-
"time_shift_type": "exponential",
|
| 347 |
-
"use_beta_sigmas": False,
|
| 348 |
-
"use_dynamic_shifting": True,
|
| 349 |
-
"use_exponential_sigmas": False,
|
| 350 |
-
"use_karras_sigmas": False,
|
| 351 |
-
}
|
| 352 |
-
scheduler = FlowMatchEulerDiscreteScheduler.from_config(scheduler_config)
|
| 353 |
-
|
| 354 |
# Load the model pipeline
|
| 355 |
-
pipe = QwenImagePipeline.from_pretrained("Qwen/Qwen-Image-2512",
|
| 356 |
-
pipe.load_lora_weights(
|
| 357 |
-
"lightx2v/Qwen-Image-Lightning", weight_name="Qwen-Image-Lightning-4steps-V2.0-bf16.safetensors"
|
| 358 |
-
)
|
| 359 |
-
pipe.fuse_lora()
|
| 360 |
pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
|
| 361 |
|
| 362 |
# --- Ahead-of-time compilation ---
|
|
@@ -401,7 +370,7 @@ def infer(
|
|
| 401 |
Generates an image using the local Qwen-Image diffusers pipeline.
|
| 402 |
"""
|
| 403 |
# Hardcode the negative prompt as requested
|
| 404 |
-
negative_prompt =
|
| 405 |
|
| 406 |
if randomize_seed:
|
| 407 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -435,10 +404,10 @@ def infer(
|
|
| 435 |
|
| 436 |
# --- Examples and UI Layout ---
|
| 437 |
examples = [
|
| 438 |
-
"
|
| 439 |
"Realistic still life photography style: A single, fresh apple resting on a clean, soft-textured surface. The apple is slightly off-center, softly backlit to highlight its natural gloss and subtle color gradients—deep crimson red blending into light golden hues. Fine details such as small blemishes, dew drops, and a few light highlights enhance its lifelike appearance. A shallow depth of field gently blurs the neutral background, drawing full attention to the apple. Hyper-detailed 8K resolution, studio lighting, photorealistic render, emphasizing texture and form.",
|
| 440 |
"一位东亚女性,约20-30岁,身材娇小,皮肤白皙如瓷,呈现冷白皮质感,水润光滑,面部轮廓柔和,眼神清澈灵动,眼妆自然清透,睫毛纤长卷翘,唇色为浅粉色,微微上扬的嘴角带着俏皮可爱的笑意。她拥有一头深黑色长发,发丝蓬松柔顺,自然垂落肩头,碎发轻拂脸颊,增添灵动感,发尾微卷,随性散落。身着浅色高质感休闲连衣裙,材质似丝绸或雪纺,搭配一顶贝雷帽,帽檐微微压低,凸显偶像气质。手腕佩戴多条精致手链,金属与珍珠元素交织,正自然展示于镜头前。背景为少女心爆棚的饰品店,店内装修精致,陈列琳琅满目,暖光灯与柔和自然光交织,角落一棵圣诞树点缀着彩灯与装饰物,整体氛围温馨浪漫,画面呈日常快照风格,构图随意却充满生活美感,8K高清摄影。",
|
| 441 |
-
"一位东亚女性,约20
|
| 442 |
"一位年轻的东亚女性,约20-25岁,开怀大笑,双眼弯如月牙,神情明媚愉悦。她肤色白皙,面部轮廓柔和,妆容清新自然,唇色鲜亮。深棕色大波浪卷发蓬松丰盈,随意披散于肩头。上身穿着明黄色细肩带背心,下搭浅蓝色牛仔短裤,整体穿搭休闲活力。背景是一面色彩斑斓的大型街头涂鸦墙,图案鲜明、笔触奔放,阳光从前方斜照,光线充足明亮,营造出自由、热烈而充满街头艺术气息的氛围。",
|
| 443 |
"一位东亚女性,约19岁,身形纤瘦,高鼻梁,黑色长发自然垂落。她身处温馨的咖啡馆内,木质桌面上摆放着一杯拉花咖啡、一块抹茶蛋糕和几张照片卡片。她身穿质感软糯的彩色条纹针织毛衣,纹理细腻,色彩柔和,凸显温暖氛围。她以手肘轻撑桌面,一手托着脸颊,姿态放松自然,脸上带着清甜微笑,眼神灵动而平静,目光或看向镜头或微微偏移,神情慵懒随性。阳光透过发丝洒在面部,肌肤呈现自然状态,无明显妆感。画面为俯视视角,整体光线柔和但略不均匀,存在轻微过曝与运动模糊,保留写实摄影风格的细微噪点,高光不过度溢出,阴影保留细节,构图随意,如iPhone随手抓拍,呈现出真实、松弛又治愈的少女日常瞬间。",
|
| 444 |
"一只美洲豹潜伏在热带雨林的河岸边,压低健壮的身躯,深黄色皮毛上布满比普通豹子更大更黑的斑点,下颌线条强健有力。它目光专注地锁定水中动静,墨绿色河面清晰倒映出它的轮廓。背景是茂密潮湿的蕨类植物与交错缠绕的藤蔓,整体光线昏暗,氛围紧张而原始。图像中无任何文字、人像或人工标识。",
|
|
@@ -455,13 +424,7 @@ css = """
|
|
| 455 |
|
| 456 |
with gr.Blocks(css=css) as demo:
|
| 457 |
with gr.Column(elem_id="col-container"):
|
| 458 |
-
|
| 459 |
-
gr.HTML("""
|
| 460 |
-
<div id="logo-title">
|
| 461 |
-
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" alt="Qwen-Image Logo" width="400" style="display: block; margin: 0 auto;">
|
| 462 |
-
<h2 style="font-style: italic;color: #5b47d1;margin-top: -33px !important;margin-left: 133px;">Fast, 4-steps with Lightining LoRA</h2>
|
| 463 |
-
</div>
|
| 464 |
-
""")
|
| 465 |
gr.Markdown("[Learn more](https://github.com/QwenLM/Qwen-Image) about the Qwen-Image series. Try on [Qwen Chat](https://chat.qwen.ai/), or [download model](https://huggingface.co/Qwen/Qwen-Image) to run locally with ComfyUI or diffusers.")
|
| 466 |
with gr.Row():
|
| 467 |
prompt = gr.Text(
|
|
@@ -475,8 +438,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 475 |
result = gr.Image(label="Result", show_label=False, type="pil")
|
| 476 |
|
| 477 |
with gr.Accordion("Advanced Settings", open=False):
|
| 478 |
-
# Negative prompt UI element is removed here
|
| 479 |
-
|
| 480 |
seed = gr.Slider(
|
| 481 |
label="Seed",
|
| 482 |
minimum=0,
|
|
@@ -501,15 +462,15 @@ with gr.Blocks(css=css) as demo:
|
|
| 501 |
minimum=0.0,
|
| 502 |
maximum=10.0,
|
| 503 |
step=0.1,
|
| 504 |
-
value=
|
| 505 |
)
|
| 506 |
|
| 507 |
num_inference_steps = gr.Slider(
|
| 508 |
label="Number of inference steps",
|
| 509 |
minimum=1,
|
| 510 |
-
maximum=
|
| 511 |
step=1,
|
| 512 |
-
value=
|
| 513 |
)
|
| 514 |
|
| 515 |
gr.Examples(examples=examples, inputs=[prompt], outputs=[result, seed], fn=infer, cache_examples=False)
|
|
@@ -519,7 +480,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 519 |
fn=infer,
|
| 520 |
inputs=[
|
| 521 |
prompt,
|
| 522 |
-
# negative_prompt is no longer an input from the UI
|
| 523 |
seed,
|
| 524 |
randomize_seed,
|
| 525 |
aspect_ratio,
|
|
|
|
| 3 |
import random
|
| 4 |
import torch
|
| 5 |
import spaces
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
from PIL import Image
|
| 9 |
+
from diffusers import QwenImagePipeline
|
| 10 |
from qwenimage.qwen_fa3_processor import QwenDoubleStreamAttnProcessorFA3
|
| 11 |
from optimization import optimize_pipeline_
|
|
|
|
| 12 |
|
| 13 |
+
from huggingface_hub import login, InferenceClient
|
| 14 |
login(token=os.environ.get('hf'))
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# --- Prompt Enhancement using Hugging Face InferenceClient ---
|
| 18 |
|
| 19 |
+
def polish_prompt(original_prompt, system_prompt):
|
| 20 |
+
"""
|
| 21 |
+
Rewrites the prompt using a Hugging Face InferenceClient.
|
| 22 |
+
"""
|
| 23 |
+
# Ensure HF_TOKEN is set
|
| 24 |
+
api_key = os.environ.get("HF_TOKEN") or os.environ.get("hf")
|
| 25 |
+
if not api_key:
|
| 26 |
+
raise EnvironmentError("HF_TOKEN is not set. Please set it in your environment.")
|
| 27 |
+
|
| 28 |
+
# Initialize the client
|
| 29 |
+
client = InferenceClient(
|
| 30 |
+
provider="cerebras",
|
| 31 |
api_key=api_key,
|
| 32 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
# Format the messages for the chat completions API
|
| 35 |
+
messages = [
|
| 36 |
+
{"role": "system", "content": system_prompt},
|
| 37 |
+
{"role": "user", "content": original_prompt}
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
try:
|
| 41 |
+
# Call the API
|
| 42 |
+
completion = client.chat.completions.create(
|
| 43 |
+
model="Qwen/Qwen3-235B-A22B-Instruct-2507",
|
| 44 |
+
messages=messages,
|
| 45 |
+
)
|
| 46 |
+
polished_prompt = completion.choices[0].message.content
|
| 47 |
+
polished_prompt = polished_prompt.strip().replace("\n", " ")
|
| 48 |
+
return polished_prompt
|
| 49 |
+
except Exception as e:
|
| 50 |
+
print(f"Error during API call to Hugging Face: {e}")
|
| 51 |
+
# Fallback to original prompt if enhancement fails
|
| 52 |
+
return original_prompt
|
| 53 |
|
| 54 |
|
| 55 |
def get_caption_language(prompt):
|
| 56 |
+
"""Detects if the prompt contains Chinese characters."""
|
| 57 |
ranges = [
|
| 58 |
('\u4e00', '\u9fff'), # CJK Unified Ideographs
|
|
|
|
|
|
|
| 59 |
]
|
| 60 |
for char in prompt:
|
| 61 |
if any(start <= char <= end for start, end in ranges):
|
| 62 |
return 'zh'
|
| 63 |
return 'en'
|
| 64 |
|
| 65 |
+
|
| 66 |
def polish_prompt_en(original_prompt):
|
| 67 |
SYSTEM_PROMPT = '''
|
| 68 |
# Image Prompt Rewriting Expert
|
|
|
|
| 84 |
3. **Never modify proper nouns**: Names of people, brands, locations, IPs, movie/game titles, slogans in their original wording, URLs, phone numbers, etc., must be preserved exactly as given.
|
| 85 |
4. **Fully represent all textual content**:
|
| 86 |
- If the image contains visible text, **enclose every piece of displayed text in English double quotation marks (" ")** to distinguish it from other content.
|
| 87 |
+
- Accurately describe the text's content, position, layout direction (horizontal/vertical/wrapped), font style, color, size, and presentation method (e.g., printed, embroidered, neon).
|
| 88 |
- If the prompt implies the presence of specific text or numbers (even indirectly), explicitly state the **exact textual/numeric content**, enclosed in double quotation marks. Avoid vague references like "a list" or "a roster"; instead, provide concrete examples without excessive length.
|
| 89 |
- If no text appears in the image, explicitly state: "The image contains no recognizable text."
|
| 90 |
5. **Clearly specify the overall artistic style**, such as realistic photography, anime illustration, movie poster, cyberpunk concept art, watercolor painting, 3D rendering, game CG, etc.
|
|
|
|
| 104 |
- Clothing: specify all garments, including tops, bottoms, footwear, one-piece outfits, and outerwear. Note their type (e.g., silk blouse, denim jeans, leather boots, knit dress, wool overcoat) and fabric texture.
|
| 105 |
- Hairstyle: describe the hair color, length, texture, and style. For color, specify the shade (e.g., jet black, platinum blonde, auburn red). For style, describe the cut and arrangement (e.g., long and straight, curly with bangs, a center-parted bob).
|
| 106 |
- Accessories: list any additional items such as headwear, jewelry (earrings, necklaces, rings), glasses, etc.
|
| 107 |
+
3. **Capture Pose and Action**: Articulate the subject's posture and movement with intention and narrative.
|
| 108 |
- Body Posture: describe the overall stance or position (e.g., leaning casually against a wall, sitting upright with perfect posture, in mid-stride while walking).
|
| 109 |
- Gaze & Head Position: specify the direction of the subject's gaze (e.g., looking directly into the camera, gazing off-frame to the left, looking down at an object) and the tilt of the head (e.g., tilted slightly, held high).
|
| 110 |
- Hand & Arm Gestures: detail the placement and action of the hands and arms (e.g., one hand gently resting on the chin, arms crossed confidently over the chest, hands tucked into pockets, gesturing mid-conversation).
|
|
|
|
| 121 |
"An East Asian male, approximately 25-35 years old, sits poised on a sleek white modern chair. He wears a tailored black blazer over a black crew-neck top, complemented by a silver chain necklace featuring a red heart-shaped pendant. His left ear is adorned with a small gold stud earring, and his left wrist bears a red cord bracelet with a matching heart charm. His hairstyle is short, black, and textured with volume, framing a clean, oval face with smooth, fair skin. His expression is calm and focused, gazing directly into the camera with neutral makeup enhancing his natural features — defined brows, subtle eyeliner, and soft pink lips. The background is a gradient of deep gray to black, accented by a minimalist light gray geometric structure to the right. Lighting is soft and diffused, highlighting his facial contours and attire without harsh shadows, creating a polished, high-fashion studio aesthetic. The image contains no recognizable text."
|
| 122 |
"A young woman of Caucasian ethnicity, likely in her 20s, stands outdoors on a sunlit city sidewalk. She has long, wavy brown hair cascading over her shoulders, fair skin with a soft matte finish, and subtle makeup featuring defined eyebrows, natural eyeliner, and soft red lipstick. Her expression is gentle and confident, with a slight smile. She wears a pale pink ribbed turtleneck sweater under a sleeveless navy blue knee-length dress with clean lines and a smooth texture. In her right hand, she lightly touches her hair near her temple; her left hand holds a matching pale pink leather clutch. The background features tall urban buildings with reflective glass facades, blurred pedestrians, and a yellow taxi partially visible on the right. Sunlight casts warm highlights on her hair and skin, creating a bright, airy atmosphere. The image contains no recognizable text."
|
| 123 |
"A South Asian bride, aged 20-30, wears a luxurious red and gold traditional wedding outfit with intricate embroidery. Her head is adorned with a maang tikka featuring gold beads and red gemstones, and a sheer veil edged with golden pearls. Her makeup is elegant and bold: deep brown smoky eyeshadow, voluminous curled lashes, sharply defined brows, and rich red lipstick. Her fair skin glows under soft highlighter. Both hands are decorated with elaborate reddish-brown henna patterns; her right ring finger bears a round gold ring with a central pearl. She wears multiple ornate gold bangles on each wrist and a small gold nose ring. Her dark hair is neatly styled beneath the headpiece. She gently rests her chin on her clasped hands in a poised posture. Traditional gold earrings dangle from her ears. The background features blurred crimson drapes and green festive garlands, bathed in warm, bright lighting that enhances the solemn yet celebratory wedding atmosphere. The image contains no recognizable text."
|
| 124 |
+
"A striking young adult woman of mixed or Latinx heritage with rich dark brown skin and glossy, wet-look black hair pulled into a severe, sleek high ponytail. Her facial features are sharp and defined: brows precisely shaped, eyes subtly enhanced with matte neutral eyeshadow, and lips in soft natural pink. She wears contrasting high-end earrings — one a diamond-encrusted silver knot with teardrop pendant, the other a single pearl on a diamond-studded hook. She is draped in a luxurious white shawl with fine fringe texture over a shimmering silver sleeveless V-neck top. The background is softly blurred, revealing only the faint silhouette of another person's head behind her right shoulder, suggesting a high-fashion runway or elite studio photoshoot. Lighting is crisp and even, characteristic of professional fashion photography, emphasizing elegance, contrast, and modern sophistication. The image contains no recognizable text."
|
| 125 |
"A young East Asian baby with short dark hair and fair skin sits cross-legged on a textured beige woven mat, wearing a fluffy blue fleece onesie with a front zipper and hood. The baby holds a small red wooden cube in its right hand, with wide, curious eyes and slightly parted lips. Surrounding the baby are scattered colorful wooden geometric blocks—green cylinders, yellow triangles, blue cubes, and red prisms—on the mat. Behind the baby, three white plastic storage drawers are stacked vertically against a light beige wall. The lighting is soft and natural, suggesting indoor daylight, creating a warm, calm atmosphere. The image contains no recognizable text."
|
| 126 |
"A curious East Asian toddler, approximately 1–2 years old, with short dark hair and fair skin, sits cross-legged on a soft beige textured carpet. The child wears a light green and white short-sleeve onesie decorated with colorful floral patterns and whimsical cartoon animals. Holding a magnifying glass with a gleaming golden frame and wooden handle in both hands, the toddler gazes intently toward the right edge of the frame, displaying focused curiosity. Behind them, a rustic wooden cabinet with two drawers and metal handles is softly blurred in the background. Warm, diffused natural daylight streams from a window on the left, illuminating the scene and creating a serene, tranquil atmosphere that emphasizes innocence and quiet discovery. The image contains no recognizable text."
|
| 127 |
"A warm, intimate outdoor scene captures a couple embracing. The man, seen from behind, has short dark curly hair and wears a light blue denim jacket. The woman, facing the camera, has long dark hair with a red polka-dotted headband, bright red lipstick, and a joyful smile showing affection. Her arms wrap around his shoulders; her left hand displays a simple silver ring. Soft golden-hour lighting bathes the green park background, creating a dreamy bokeh effect. The composition is a medium close-up shot with shallow depth of field, emphasizing emotional connection and tenderness. The image contains no recognizable text."
|
| 128 |
+
"An adult, visible only from the torso and arms, gently yet firmly holds a one-year-old East Asian baby girl. The infant has glossy black hair tied in a small ponytail, adorned with a light gray bow clip. Her round face features large, clear eyes gazing calmly to the right of the frame; her skin is fair and unadorned. She wears a soft cream-colored long-sleeve onesie printed with green botanicals and colorful flowers. The adult wears a textured beige cotton long-sleeve shirt, arms securely cradling the baby's back and waist. The background is a modern minimalist interior: pale gray-brown walls, ceiling with recessed linear lighting and ventilation grille. Lighting is warm and even, evoking a serene, cozy, and safe domestic atmosphere. The image contains no recognizable text."
|
| 129 |
"An elderly woman of likely Southeast Asian ethnic minority heritage, with deeply wrinkled skin and a warm, gentle smile, gazes directly at the camera. Her dark, thin hair is partially visible beneath a large, black triangular velvet headdress showing frayed edges. She has a round face with prominent cheekbones, dark eyes, and natural features without makeup. She wears a black garment with vibrant blue woven trim along the collar and a silver rectangular brooch fastened at the throat. Long, colorful beaded earrings — featuring red, blue, green, yellow, white, and brown beads with tassels — dangle from her ears. The background is softly blurred, suggesting an indoor or shaded environment with soft, directional natural lighting that accentuates the texture of her skin and garments. The image contains no recognizable text."
|
| 130 |
|
| 131 |
---
|
|
|
|
| 164 |
"The image is titled 'LUXURY CRUISES: The Pinnacle of Ocean Travel & Indulgence' in large, gold and white text at the top against a dark blue background. Below this title, the image is divided into four quadrants surrounding a central circular illustration of a luxury cruise ship sailing through turquoise waters with green islands and a sunset in the background.\n\nTop left quadrant: Headed by 'SPACIOUS, ALL-SUITE ACCOMMODATIONS' in bold black text on a cream banner. It depicts a luxurious suite with a king bed, sofa, marble bathtub, and ocean-view balcony. Below the image, text reads: 'Generously sized suites, many with verandas. Dedicated butler service and premium amenities. A private sanctuary.'\n\nTop right quadrant: Headed by 'EXQUISITE CULINARY JOURNEYS' in bold black text on a cream banner. It shows an elegant dining setting with a gourmet seafood dish (lobster and scallops) on a plate, a glass of red wine, and a table set for two overlooking the sea. Below the image, text reads: 'Gourmet, open-seating dining. Multiple specialty venues. Premium beverages and fine wines typically included.'\n\nBottom left quadrant: Headed by 'UNRIVALED PERSONALIZED SERVICE' in bold black text on a cream banner. It illustrates crew members in uniform attending to guests relaxing on deck chairs, one serving towels and another polishing railings. Intimate, uncrowded environment with refined enrichment programs.'\n\nBottom right quadrant: Headed by 'EXCLUSIVE & IMMERSIVE DESTINATIONS' in bold black text on a cream banner. It features a small motorized tender boat approaching a secluded beach with palm trees and ancient ruins in the background. Below the image, text reads: 'EXCLUSIVE & IMMERSIVE DESTINATIONS Access to smaller, less crowded ports. Curated, culturally rich shore excursions. Explore remote corners of the globe.'\n\nAt the very bottom, centered on the dark blue background, is the tagline: 'An elevated experience of comfort, discovery, and seamless elegance.' No other text appears in the image."
|
| 165 |
"A composite promotional banner set featuring five distinct designs. Top banner: a young Caucasian woman with red hair, wearing a bright yellow beret and burgundy coat, poses thoughtfully in a mystical blue forest with glowing mushrooms; text reads \"探秘童话秘境, 限时特惠!\" (top left, white bold font). Middle banner: grayscale image of hands holding an old leather-bound book; text says \"沉浸知识海洋, 全场五折起!\" (left side, beige serif font). Bottom row: left panel shows silhouettes of deer, owls, and fox against sunset with text \"自然之声, 野趣生活.\" (white sans-serif); center panel displays colorful paper planes flying over clouds and gears with clock, text \"创意无限, 飞向未来.\" (blue background, white font); right panel features ornate mechanical clock surrounded by flowers with text \"时间艺术, 永恒珍藏.\" (brown background, dark brown font). All banners use vibrant color contrasts and symbolic imagery for marketing purposes. No other text appears in the image"
|
| 166 |
"The image displays a presentation slide titled 'Workshop Models in Creative Writing: Advantages & Challenges'. The slide is divided into two main sections: 'ADVANTAGES' on the left with a green header and checkmark icons, and 'CHALLENGES' on the right with a red header and cross icons. At the bottom, there is a conclusion line.\n\nUnder 'ADVANTAGES':\n- 'Peer Feedback & Diverse Perspectives (Collaborative Learning, Audience Awareness)'\n- 'Skill Development (Critical Analysis, Editing Practice, Voice Finding)'\n- 'Community Building (Supportive Environment, Reduced Isolation)'\n\nUnder 'CHALLENGES':\n- 'Variable Quality of Feedback (Vague, Biased, or Unhelpful Comments)'\n- 'Emotional & Vulnerability Toll (Defensiveness, Discouragement, Anxiety)'\n- 'Time Constraints & Balancing Acts (Limited Focus per Piece, Critique vs. Writing Time)'\n\nAt the bottom center: 'Conclusion: Fostering Growth while Navigating Hurdles'. No other text appears in the image."
|
| 167 |
+
"This is a movie poster. The upper right corner features the text "聯手制霸或獨自殞落". In the lower-middle section is "哥吉拉與金剛 新帝國", and at the bottom center is "3月27日(週三)大銀幕鉅獻". The "LEGENDARY" logo is in the lower left, "IMAX同步上映" is below the center, and the "WARNER BROS" logo is in the lower right. At the center of the image are the giant letters "GK". To the left is the silhouette of Godzilla, and to the right is the figure of King Kong. Below them are helicopters and a distant statue. The background is a sky with clouds, rendered in a pink and blue color palette, creating an epic science-fiction atmosphere. No other text appears in the image."
|
| 168 |
+
"In the upper left corner of the image are the large white characters "GOOD TEA AND SET" and "好茶和集". Along the left edge is smaller text reading "源自南靖核心产区 自带山水茶韵", and at the bottom center is the text in parentheses: "(N24°低纬度) 南靖丹桂茶". On the right, a pair of hands is visible, holding a dark brown ceramic teapot and pouring hot tea. A thin stream of water flows from the spout into a white porcelain gaiwan (lidded bowl) below, which contains tea leaves and from which steam gently rises. The gaiwan rests on a light-colored wooden tray, with its white lid placed beside it. The background consists of a dark wooden surface and soft side lighting, creating a serene tea ceremony atmosphere. Only the person's hands are shown, with a warm skin tone and no discernible accessories or clothing, making it impossible to determine gender, age, or facial features. No other text appears in the image."
|
| 169 |
+
"At the top of the poster, the white text "豆瓣评分 8.5" is prominently displayed. In the middle is the "青年影展" logo. The center features the large title "山里的星星" in a bold, calligraphic style, with its corresponding English title "STARS IN THE MOUNTAINS" below in a clean, modern font. The director's name, "李静", is noted in the upper-middle right. At the bottom, the release date, "9月10日 教师节献映", and the main cast list are clearly listed. The cast list reads: "刘德华,周杰伦". The background showcases vast green terraced fields and rolling green mountains, with a fresh and natural color palette. In the foreground, a young East Asian male teacher in a light-colored shirt and dark trousers smiles gently while pointing at an open picture book. He is surrounded by several children from the mountainous region, who are dressed modestly but neatly, with bright smiles and expressions of joy and concentration. The overall lighting is bright and soft, creating a warm, touching atmosphere filled with hope and the tenderness of education. No other text appears in the image."
|
| 170 |
+
"This is a six-panel cartoon comic about a subway's emergency response procedures. In the largest panel in the upper left, an anthropomorphic subway train smiles and points to the right. Above it, a speech bubble contains the text "紧急情况处理中!". To its right, a megaphone icon is next to the words "广播系统:紧急疏散指令", and further right, a blue display screen reads "请保持冷静,跟随指引". The background is an orange-yellow radial pattern. The middle-left panel, titled "疏散通道:逃生门/滑梯", shows passengers evacuating from a carriage down a slide. The middle-right panel, titled "应急照明 & 通讯:备用电源,紧急电话", depicts passengers using light sticks and an emergency phone. The lower-left panel, titled "通风排烟:排出烟雾,送入新风", shows large fans clearing smoke from a tunnel. The lower-right panel, titled "安全停车,应急开启", shows the anthropomorphic train pressing a large red button. The title of each panel is located at its top. No other text appears in the image."
|
| 171 |
+
"The image features a tech-inspired background with a deep blue color scheme. The left side is adorned with dynamic, flowing visual effects, including curved lines and light dots composed of blue and purple light. Thin, glowing curves and circular light spots of varying sizes, with colors graduating from light blue to purplish-pink, are distributed from the upper left to the left edge. In the middle of the left side, the characters "目录" are displayed in a large, bold, white sans-serif font. On the right, a rectangular box with a thin white border is divided into four sections in a 2x2 grid. The top-left section is titled "01 自我评估" with the text "我很棒" below it. The top-right section is "02 职业认知" with "认真工作,努力生活" below it. The bottom-left section is "03 职业决策" with "坚定目标,不退缩" below it. The bottom-right section is "04 计划实施" with "脚踏实地,勇往直前" below it. All numbers and titles are in bold white font, while the descriptive text is in a smaller, regular white font. The image contains no human figures or features. The overall atmosphere is modern, professional, and futuristic. No other text appears in the image"
|
| 172 |
---
|
| 173 |
|
| 174 |
## Subtask 3: General Image Rewriting
|
|
|
|
| 192 |
**Example Output**:
|
| 193 |
"A rugged mountain landscape under a clear blue sky with scattered white clouds. Snow-capped peaks dominate the background, with steep rocky slopes and visible glaciers. In the foreground, a rocky trail with scattered boulders and dry golden grass leads toward the mountains. Two red wooden trail markers stand on the right side of the path, one pointing left and the other pointing right; neither contains any visible text or inscriptions. No people, animals, or man-made structures beyond the trail markers are present. The lighting suggests midday sun, casting sharp shadows and highlighting textures in the rocks and snow.The image contains no recognizable text."
|
| 194 |
"A fluffy white and light gray cat with large green eyes and a small pink nose is lying down on a white surface. The cat is wearing a plush white bunny ear headband with pink inner ear linings. Its posture is relaxed, front paws tucked under its chest, whiskers visible, and gaze directed forward. The background is plain white, creating a clean, bright studio lighting effect with soft shadows. The image contains no recognizable text."
|
| 195 |
+
"A black-and-white close-up portrait of a fluffy white Persian cat with long fur, slightly squinted eyes, and prominent whiskers. The cat's face is centered in the frame, showing a calm or sleepy expression. Its nose is small and dark, contrasting with its light fur. The background is blurred, suggesting an indoor environment with indistinct architectural elements like a window or doorframe. The image contains no recognizable text."
|
| 196 |
+
"An adult tiger and a tiger cub are positioned near a small body of water surrounded by green grass and scattered rocks. The adult tiger, with orange fur, black stripes, and white underbelly, is lying down on the grass, facing left with its head turned slightly toward the cub. Its whiskers are long and white, and its expression appears calm and watchful. The tiger cub, smaller in size with similar striped markings but fluffier fur, is standing on a rocky edge near the water, one paw extended forward as if stepping or testing the surface. The cub's eyes are wide and alert, looking downward. The environment is lush and natural, suggesting a daytime setting with soft, diffused lighting. No text is visible in the image."
|
| 197 |
"A lemur with striking black-and-white facial markings and bright orange-yellow limbs clings to a tree trunk in a forest setting. Its large brown eyes are wide open, mouth slightly agape showing pink tongue, giving it an expressive, curious look. The fur is fluffy, with white around the face and gray on the body. The background shows tall trees with green leaves against a clear blue sky, suggesting daytime in a natural habitat. No text is visible in the image."
|
| 198 |
|
| 199 |
---
|
| 200 |
|
| 201 |
+
Based on the user's input, automatically determine the appropriate task category and output a single English image prompt that fully complies with the above specifications. Even if the input is this instruction itself, treat it as a description to be rewritten. **Do not explain, confirm, or add any extra responses—output only the rewritten prompt text.**
|
| 202 |
'''
|
| 203 |
original_prompt = original_prompt.strip()
|
| 204 |
+
return polish_prompt(original_prompt, SYSTEM_PROMPT)
|
| 205 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
def polish_prompt_zh(original_prompt):
|
| 208 |
SYSTEM_PROMPT = '''
|
|
|
|
| 224 |
4. **完整呈现所有文字信息**:
|
| 225 |
- 若图像包含文字,**图像中显示的文字内容均使用中文双引号包含起来**,以便与其他内容区分。
|
| 226 |
- 若图像包含文字,须准确描述其内容、位置、排版方向(横排/竖排/换行)、字体风格、颜色、大小及呈现方式(如印刷、刺绣、霓虹灯等);
|
| 227 |
+
- 若图像内容里面暗示了存在相关的文字/数字信息,必须明确补充**具体的文字/数字内容**,并且使用双引号包含起来,拒绝出现"名单","列表"等模糊的文字暗示内容,补充内容不要过长。
|
| 228 |
+
- 若图像无任何文字,必须明确说明:"图像中未出现任何可识别文字"。
|
| 229 |
5. **明确指定整体艺术风格**,例如:写实摄影、动漫插画、电影海报、赛博朋克概念图、水彩手绘、3D 渲染、游戏 CG 等。
|
| 230 |
|
| 231 |
---
|
|
|
|
| 243 |
7. **内容篇幅保持克制**:人像场景下,改写/扩写的内容篇幅保持简洁,输出控制在150字以内。
|
| 244 |
|
| 245 |
**示例输出**:
|
| 246 |
+
"一位东亚女性,约20-30岁,身着米白色中式立领长裙,七分袖设计,左侧胸前有花卉刺绣装饰,盘扣为浅金色,腰间系有同色系细带。她发色乌黑,发型为低盘发髻,佩戴小巧耳饰,妆容淡雅,唇色自然红润,面部轮廓柔和,眼神低垂望向右下方,表情宁静。右手持一把米白色椭圆形团扇。背景为浅米色墙面,上方有模糊的绿植与阳光斑驳光影,整体光线柔和明亮,氛围温婉静谧。"
|
| 247 |
+
"一位东亚女性,约25-30岁,坐在木质圆桌旁,身穿红色无袖V领上衣和白色下装,发色深棕,发型为半扎发并饰有白色蕾丝发饰,佩戴金色圆环耳环和一枚花朵造型戒指。她面容清秀,五官柔和,皮肤白皙,妆容自然。她面带微笑,眼神温柔注视镜头,左手持小勺盛着奶油状甜点,右手轻抬。桌上摆放一杯琥珀色饮品、一杯带红色吸管的橙黄色饮料、一块吃剩的蛋糕及餐具。背景为暖色调咖啡馆或手作店,木制洞洞板货架陈列毛线球、罐装物品与编织篮。环境光线柔和,氛围温馨舒适。"
|
| 248 |
+
"一位东亚女性,约20-30岁,她仰头望向天空,神情宁静。她的发色为深棕色,齐刘海自然垂落,皮肤白皙带有细微雀斑,眼妆使用了金黄色眼影,睫毛纤长,唇色为自然粉红,嘴唇微张。背景模糊,呈现蓝绿色调,似户外自然环境,光线柔和,营造出梦幻氛围。"
|
| 249 |
|
| 250 |
---
|
| 251 |
|
|
|
|
| 267 |
- 光照对文字可读性的影响(反光、背光、夜间照明等);
|
| 268 |
- 整体色调与艺术风格(复古、极简、赛博朋克等)。
|
| 269 |
4. **在信息图/知识类场景中适度补充文字**:
|
| 270 |
+
- 若prompt中文字信息不完整但暗示存在文字,则补充布局及精确且精简的典型文案。必须明确列出具体的文字内容,拒绝"名单,列表,搭配文字"等模糊的文字暗示描述,而要将其细化为具体的文字内容。
|
| 271 |
- 若用户已提供详细文字,则以忠实保留为主,仅作必要润色;
|
| 272 |
- 文字内容必须与画面内容一一对应,拒绝模糊的描述。
|
| 273 |
|
| 274 |
**示例输出**:
|
| 275 |
+
"这是一张电影海报,右上角写着"聯手制霸或獨自殞落"。中部偏下位置有"哥吉拉與金剛 新帝國"的字样,底部居中显示"3月27日(週三)大銀幕鉅獻"。左下角有"LEGENDARY"标识,中部下方有"IMAX同步上映",右下角有"WARNER BROS"标识。图像中央有巨大的"GK"字母,左侧是哥斯拉的剪影,右侧是金刚的形象,下方有直升机和远处的雕像,整体背景为天空和云层,色调为粉色和蓝色,营造出一种史诗般的科幻氛围。图像中未出现其他文字。"
|
| 276 |
+
"图像左上角有白色大字"GOOD TEA AND SET"和"好茶和集",左侧边缘有小字"源自南靖核心产区 自带山水茶韵",底部中央有括号文字"(N24°低纬度) 南靖丹桂茶"。画面右侧可见一双手正持深褐色陶壶倾倒热茶,壶嘴流出细长水流注入下方白色瓷盖碗,碗内有茶叶,蒸汽袅袅升腾。盖碗置于浅木色托盘上,旁放白色盖子。背景为深色木质桌面与柔和侧光,营造静谧茶道氛围。人物仅露出双手,肤色偏暖,无明显配饰或衣着细节,无法判断性别、年龄或面部特征。图像中未出现其他文字。"
|
| 277 |
+
"海报顶部醒目地显示白色文字"豆瓣评分 8.5",中间位置印有"青年影展"标志。中央为大幅标题"山里的星星",采用粗体书法风格,下方对应英文"STARS IN THE MOUNTAINS",字体简洁现代。右中部偏上处标注导演姓名"李静"。底部清晰列出上映日期"9月10日 教师节献映"及主要演员名单。演员名单为:"刘德华,周杰伦",背景展现一望无际的绿色梯田与层叠起伏的青山,色调清新自然。前景中一位年轻的东亚男老师身穿浅色衬衫和深色长裤,面带温和笑容,正低头指向手中打开的图画书;周围环绕着数名穿着朴素、笑容灿烂的山区孩子,孩子们肤色微黑,衣着简朴但整洁,神情专注而喜悦。整体画面光线明亮柔和,氛围温暖动人,充满希望与教育温情。图像中未出现其他文字。"
|
| 278 |
+
"这是一幅由六个分格组成的卡通漫画,内容关于地铁在紧急情况下的应对措施。左上角最大的分格中,一辆拟人化的地铁列车面带微笑,伸出右手食指指向右方。列车上方有一个对话框,内有文字"紧急情况处理中!"。列车右侧有一个喇叭图标,旁边是文字"广播系统:紧急疏散指令"。再往右是一个蓝色显示屏,上面写着"请保持冷静,跟随指引"。背景为橙黄色放射状图案。中间左侧的分格标题为"疏散通道:逃生门/滑梯",画面显示车厢内乘客正通过打开的车门沿着滑梯向下滑,地面上有绿色箭头指示方向。中间右侧的分格标题为"应急照明 & 通讯:备用电源,紧急电话",画面中有三名乘客,其中两人举着发光棒,一人正在使用墙上的紧急电话。左下角的分格标题为"通风排烟:排出烟雾,送入新风",画面展示隧道内多个大型风扇正在运转,将灰色烟雾排出。右下角的分格标题为"安全停车,应急开启",画面中拟人化地铁列车用手指按下一个红色的大按钮,按钮上方有三个矩形指示灯。每个分格的标题都位于该分格的顶部。图像中未出现其他文字。"
|
| 279 |
+
"图像整体呈现深蓝色调的科技感背景,左侧有由蓝紫色光线构成的弧形线条与光点装饰,营造出动态流动的视觉效果。左上角至左侧边缘区域分布着多条细长的发光曲线和若干大小不一的圆形光斑,颜色从浅蓝渐变至紫粉,部分光点带有微弱的辉光效果。图像左侧中部位置以大号白色字体显示"目录"二字,字体为无衬线粗体,清晰醒目。右侧区域有一个白色细边框矩形框,内部分为四个区块,呈2x2网格布局。每个区块上方是编号与标题,下方是说明文字。具体文字内容如下:右上角第一个区块文字为"01 自我评估",其下文字为"我很棒";右上角第二个区块文字为"02 职业认知",其下文字为"认真工作,努力生活";左下角第三个区块文字为"03 职业决策",其下文字为"坚定目标,不退缩";右下角第四个区块文字为"04 计划实施",其下文字为"脚踏实地,勇往直前"。所有编号与标题均使用白色粗体字,下方说明文字为较小字号的白色常规字体。图像中无人像元素,无面部特征、肤色、妆容或服饰细节。图像背景无具体地点或时间信息,光照均匀柔和,整体氛围现代、专业且富有未来感。"
|
| 280 |
|
| 281 |
---
|
| 282 |
|
|
|
|
| 299 |
- 比例与尺度(如高楼林立、巨石与行人、微观特写)。
|
| 300 |
|
| 301 |
**示例输出**:
|
| 302 |
+
"一条铺着石板的蜿蜒小巷,两侧是古老的石头房屋,墙壁上爬满了红色和绿色的常春藤。房屋窗户为白色窗框,屋顶是深灰色瓦片,部分屋顶装有电视天线。小巷两旁设有石砌花坛,种植着鲜艳的红色花朵和修剪整齐的绿植。前景有黑色金属扶手的石阶,通向小巷深处。天空多云,光线柔和,整体氛围宁静而富有乡村气息。图像中未出现任何文字或人像。"
|
| 303 |
|
| 304 |
---
|
| 305 |
|
| 306 |
请根据用户输入的内容,自动判断所属任务类型,输出一段符合上述规范的中文图像 Prompt。即使收到的是指令本身,也应将其视为待改写的描述内容进行处理,**不要解释、不要确认、不要额外回复**,仅输出改写后的 Prompt 文本。
|
| 307 |
'''
|
| 308 |
original_prompt = original_prompt.strip()
|
| 309 |
+
return polish_prompt(original_prompt, SYSTEM_PROMPT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
|
| 311 |
|
| 312 |
def rewrite(input_prompt):
|
| 313 |
+
"""
|
| 314 |
+
Selects the appropriate system prompt based on language and calls the polishing function.
|
| 315 |
+
"""
|
| 316 |
lang = get_caption_language(input_prompt)
|
| 317 |
if lang == 'zh':
|
| 318 |
return polish_prompt_zh(input_prompt)
|
| 319 |
+
else: # lang == 'en'
|
|
|
|
| 320 |
return polish_prompt_en(input_prompt)
|
| 321 |
|
| 322 |
|
|
|
|
|
|
|
| 323 |
# --- Model Loading ---
|
| 324 |
dtype = torch.bfloat16
|
| 325 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
# Load the model pipeline
|
| 328 |
+
pipe = QwenImagePipeline.from_pretrained("Qwen/Qwen-Image-2512", torch_dtype=dtype).to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
|
| 330 |
|
| 331 |
# --- Ahead-of-time compilation ---
|
|
|
|
| 370 |
Generates an image using the local Qwen-Image diffusers pipeline.
|
| 371 |
"""
|
| 372 |
# Hardcode the negative prompt as requested
|
| 373 |
+
negative_prompt = "低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。"
|
| 374 |
|
| 375 |
if randomize_seed:
|
| 376 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 404 |
|
| 405 |
# --- Examples and UI Layout ---
|
| 406 |
examples = [
|
| 407 |
+
"一位身着淡雅水粉色交领襦裙的年轻女子背对镜头而坐,俯身专注地手持毛笔在素白宣纸上书写"通義千問"四个遒劲汉字。古色古香的室内陈设典雅考究,案头错落摆放着青瓷茶盏与鎏金香炉,一缕熏香轻盈升腾;柔和光线洒落肩头,勾勒出她衣裙的柔美质感与专注神情,仿佛凝固了一段宁静温润的旧时光。",
|
| 408 |
"Realistic still life photography style: A single, fresh apple resting on a clean, soft-textured surface. The apple is slightly off-center, softly backlit to highlight its natural gloss and subtle color gradients—deep crimson red blending into light golden hues. Fine details such as small blemishes, dew drops, and a few light highlights enhance its lifelike appearance. A shallow depth of field gently blurs the neutral background, drawing full attention to the apple. Hyper-detailed 8K resolution, studio lighting, photorealistic render, emphasizing texture and form.",
|
| 409 |
"一位东亚女性,约20-30岁,身材娇小,皮肤白皙如瓷,呈现冷白皮质感,水润光滑,面部轮廓柔和,眼神清澈灵动,眼妆自然清透,睫毛纤长卷翘,唇色为浅粉色,微微上扬的嘴角带着俏皮可爱的笑意。她拥有一头深黑色长发,发丝蓬松柔顺,自然垂落肩头,碎发轻拂脸颊,增添灵动感,发尾微卷,随性散落。身着浅色高质感休闲连衣裙,材质似丝绸或雪纺,搭配一顶贝雷帽,帽檐微微压低,凸显偶像气质。手腕佩戴多条精致手链,金属与珍珠元素交织,正自然展示于镜头前。背景为少女心爆棚的饰品店,店内装修精致,陈列琳琅满目,暖光灯与柔和自然光交织,角落一棵圣诞树点缀着彩灯与装饰物,整体氛围温馨浪漫,画面呈日常快照风格,构图随意却充满生活美感,8K高清摄影。",
|
| 410 |
+
"一位东亚女性,约20岁,身着白色高定蕾丝连衣裙,裙摆轻盈飘动,露出修长双腿与黑色细跟高跟鞋,发色乌黑,长发自然披肩,肌肤白皙如凝脂,唇色为水润朱红,眼神温柔含光,略带腼腆地望向镜头。她坐在咖啡馆窗边,右手轻扶杯沿,杯中是一杯带有爱心拉花的深棕色咖啡,桌旁放一本翻开的纸质书与一束淡粉色康乃馨。窗外阳光斜洒,照亮她半边脸庞,营造出温暖柔和的氛围。背景为暖色调木质窗框与浅米色窗帘,左侧贴有"圣诞快乐"字样贴纸,窗外可见一棵装饰精美的圣诞树,枝头挂满彩灯与小饰品,整体画面采用超广角拍摄,无畸变,32K高清摄影,呈现出静谧而浪漫的午后时光。图像中未出现其他文字。",
|
| 411 |
"一位年轻的东亚女性,约20-25岁,开怀大笑,双眼弯如月牙,神情明媚愉悦。她肤色白皙,面部轮廓柔和,妆容清新自然,唇色鲜亮。深棕色大波浪卷发蓬松丰盈,随意披散于肩头。上身穿着明黄色细肩带背心,下搭浅蓝色牛仔短裤,整体穿搭休闲活力。背景是一面色彩斑斓的大型街头涂鸦墙,图案鲜明、笔触奔放,阳光从前方斜照,光线充足明亮,营造出自由、热烈而充满街头艺术气息的氛围。",
|
| 412 |
"一位东亚女性,约19岁,身形纤瘦,高鼻梁,黑色长发自然垂落。她身处温馨的咖啡馆内,木质桌面上摆放着一杯拉花咖啡、一块抹茶蛋糕和几张照片卡片。她身穿质感软糯的彩色条纹针织毛衣,纹理细腻,色彩柔和,凸显温暖氛围。她以手肘轻撑桌面,一手托着脸颊,姿态放松自然,脸上带着清甜微笑,眼神灵动而平静,目光或看向镜头或微微偏移,神情慵懒随性。阳光透过发丝洒在面部,肌肤呈现自然状态,无明显妆感。画面为俯视视角,整体光线柔和但略不均匀,存在轻微过曝与运动模糊,保留写实摄影风格的细微噪点,高光不过度溢出,阴影保留细节,构图随意,如iPhone随手抓拍,呈现出真实、松弛又治愈的少女日常瞬间。",
|
| 413 |
"一只美洲豹潜伏在热带雨林的河岸边,压低健壮的身躯,深黄色皮毛上布满比普通豹子更大更黑的斑点,下颌线条强健有力。它目光专注地锁定水中动静,墨绿色河面清晰倒映出它的轮廓。背景是茂密潮湿的蕨类植物与交错缠绕的藤蔓,整体光线昏暗,氛围紧张而原始。图像中无任何文字、人像或人工标识。",
|
|
|
|
| 424 |
|
| 425 |
with gr.Blocks(css=css) as demo:
|
| 426 |
with gr.Column(elem_id="col-container"):
|
| 427 |
+
gr.Markdown('<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" alt="Qwen-Image Logo" width="400" style="display: block; margin: 0 auto;">')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
gr.Markdown("[Learn more](https://github.com/QwenLM/Qwen-Image) about the Qwen-Image series. Try on [Qwen Chat](https://chat.qwen.ai/), or [download model](https://huggingface.co/Qwen/Qwen-Image) to run locally with ComfyUI or diffusers.")
|
| 429 |
with gr.Row():
|
| 430 |
prompt = gr.Text(
|
|
|
|
| 438 |
result = gr.Image(label="Result", show_label=False, type="pil")
|
| 439 |
|
| 440 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
|
|
|
| 441 |
seed = gr.Slider(
|
| 442 |
label="Seed",
|
| 443 |
minimum=0,
|
|
|
|
| 462 |
minimum=0.0,
|
| 463 |
maximum=10.0,
|
| 464 |
step=0.1,
|
| 465 |
+
value=4.0,
|
| 466 |
)
|
| 467 |
|
| 468 |
num_inference_steps = gr.Slider(
|
| 469 |
label="Number of inference steps",
|
| 470 |
minimum=1,
|
| 471 |
+
maximum=50,
|
| 472 |
step=1,
|
| 473 |
+
value=50,
|
| 474 |
)
|
| 475 |
|
| 476 |
gr.Examples(examples=examples, inputs=[prompt], outputs=[result, seed], fn=infer, cache_examples=False)
|
|
|
|
| 480 |
fn=infer,
|
| 481 |
inputs=[
|
| 482 |
prompt,
|
|
|
|
| 483 |
seed,
|
| 484 |
randomize_seed,
|
| 485 |
aspect_ratio,
|