assembledchaos commited on
Commit
9ddc8a3
路
verified 路
1 Parent(s): 97a5bf4

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +4 -4
README.md CHANGED
@@ -22,7 +22,7 @@ A Gradio demo of [Qwen/Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.
22
  - **Transparent PNG:** describe a sticker, object, or other isolated asset. The model receives Qwen's recommended transparency prompt. Transparency depends on the generated result.
23
  - Five aspect ratios around 1 megapixel, adjustable steps, reproducible seeds, and downloadable PNGs with embedded generation settings.
24
 
25
- The default is 28 inference steps; use 40 for the model card's recommended final-quality setting. Example results are cached on first use. Disable **Use a new seed each time** to reproduce a result with the same settings.
26
 
27
  ## Hosting
28
 
 
22
  - **Transparent PNG:** describe a sticker, object, or other isolated asset. The model receives Qwen's recommended transparency prompt. Transparency depends on the generated result.
23
  - Five aspect ratios around 1 megapixel, adjustable steps, reproducible seeds, and downloadable PNGs with embedded generation settings.
24
 
25
+ The default is the model card's recommended 40 inference steps; lower this for quicker previews. Example results are cached on first use. Disable **Use a new seed each time** to reproduce a result with the same settings.
26
 
27
  ## Hosting
28
 
app.py CHANGED
@@ -33,13 +33,13 @@ pipe = QwenImage21Pipeline.from_pretrained(
33
  print("Qwen-Image-2.1 pipeline loaded on CUDA via ZeroGPU.", flush=True)
34
 
35
 
36
- @spaces.GPU(duration=180)
37
  def generate(
38
  prompt: str,
39
  mode: str = "Create an image",
40
  reference: Image.Image | None = None,
41
  aspect_ratio: str = "Square 路 1:1",
42
- steps: int = 28,
43
  seed: int = 42,
44
  randomize_seed: bool = True,
45
  progress: gr.Progress = gr.Progress(track_tqdm=True),
@@ -129,7 +129,7 @@ def show_reference(mode: str) -> gr.Image:
129
  CSS = """
130
  .gradio-container { max-width: 1180px !important; margin: auto !important; }
131
  .dark .gradio-container { color: var(--body-text-color); }
132
- #intro { padding: 20px 0 12px; }
133
  #intro h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -1.5px; }
134
  #result { min-height: 420px; }
135
  #generate { min-height: 48px; }
@@ -158,7 +158,7 @@ with gr.Blocks(title="Qwen Image 2.1 Studio", delete_cache=(3600, 86400)) as dem
158
  )
159
  aspect_ratio = gr.Dropdown(list(SIZES), value="Square 路 1:1", label="Aspect ratio")
160
  with gr.Accordion("Generation settings", open=False):
161
- steps = gr.Slider(4, 40, value=28, step=1, label="Steps", info="More steps take longer. Qwen recommends 40 for final images.")
162
  randomize_seed = gr.Checkbox(True, label="Use a new seed each time")
163
  seed = gr.Number(value=42, precision=0, minimum=0, maximum=MAX_SEED, label="Seed", info="Turn off new seeds to reproduce a result.")
164
  run = gr.Button("Generate image", variant="primary", elem_id="generate")
 
33
  print("Qwen-Image-2.1 pipeline loaded on CUDA via ZeroGPU.", flush=True)
34
 
35
 
36
+ @spaces.GPU(duration=60)
37
  def generate(
38
  prompt: str,
39
  mode: str = "Create an image",
40
  reference: Image.Image | None = None,
41
  aspect_ratio: str = "Square 路 1:1",
42
+ steps: int = 40,
43
  seed: int = 42,
44
  randomize_seed: bool = True,
45
  progress: gr.Progress = gr.Progress(track_tqdm=True),
 
129
  CSS = """
130
  .gradio-container { max-width: 1180px !important; margin: auto !important; }
131
  .dark .gradio-container { color: var(--body-text-color); }
132
+ #intro { padding: 40px 0 12px; }
133
  #intro h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -1.5px; }
134
  #result { min-height: 420px; }
135
  #generate { min-height: 48px; }
 
158
  )
159
  aspect_ratio = gr.Dropdown(list(SIZES), value="Square 路 1:1", label="Aspect ratio")
160
  with gr.Accordion("Generation settings", open=False):
161
+ steps = gr.Slider(4, 40, value=40, step=1, label="Steps", info="40 is Qwen's recommended setting. Lower values give quicker previews.")
162
  randomize_seed = gr.Checkbox(True, label="Use a new seed each time")
163
  seed = gr.Number(value=42, precision=0, minimum=0, maximum=MAX_SEED, label="Seed", info="Turn off new seeds to reproduce a result.")
164
  run = gr.Button("Generate image", variant="primary", elem_id="generate")