Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from diffusers import DiffusionPipeline
|
|
| 6 |
# Load the pipeline once at startup
|
| 7 |
print("Loading Z-Image-Turbo pipeline...")
|
| 8 |
pipe = DiffusionPipeline.from_pretrained(
|
| 9 |
-
"Z-Image-Turbo",
|
| 10 |
torch_dtype=torch.bfloat16,
|
| 11 |
low_cpu_mem_usage=False,
|
| 12 |
)
|
|
@@ -38,7 +38,11 @@ def generate_image(prompt, height, width, num_inference_steps, seed, randomize_s
|
|
| 38 |
|
| 39 |
# Example prompts
|
| 40 |
examples = [
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
]
|
| 43 |
|
| 44 |
# Custom theme with modern aesthetics (Gradio 6)
|
|
@@ -61,8 +65,8 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 61 |
# Header
|
| 62 |
gr.Markdown(
|
| 63 |
"""
|
| 64 |
-
#
|
| 65 |
-
**Ultra-fast AI image generation**
|
| 66 |
""",
|
| 67 |
elem_classes="header-text"
|
| 68 |
)
|
|
@@ -78,7 +82,7 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 78 |
autofocus=True,
|
| 79 |
)
|
| 80 |
|
| 81 |
-
with gr.Accordion("⚙️ Advanced Settings", open=
|
| 82 |
with gr.Row():
|
| 83 |
height = gr.Slider(
|
| 84 |
minimum=512,
|
|
@@ -253,4 +257,5 @@ if __name__ == "__main__":
|
|
| 253 |
"gradio"
|
| 254 |
],
|
| 255 |
mcp_server=True
|
|
|
|
| 256 |
)
|
|
|
|
| 6 |
# Load the pipeline once at startup
|
| 7 |
print("Loading Z-Image-Turbo pipeline...")
|
| 8 |
pipe = DiffusionPipeline.from_pretrained(
|
| 9 |
+
"Tongyi-MAI/Z-Image-Turbo",
|
| 10 |
torch_dtype=torch.bfloat16,
|
| 11 |
low_cpu_mem_usage=False,
|
| 12 |
)
|
|
|
|
| 38 |
|
| 39 |
# Example prompts
|
| 40 |
examples = [
|
| 41 |
+
["Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp, bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda, blurred colorful distant lights."],
|
| 42 |
+
["A majestic dragon soaring through clouds at sunset, scales shimmering with iridescent colors, detailed fantasy art style"],
|
| 43 |
+
["Cozy coffee shop interior, warm lighting, rain on windows, plants on shelves, vintage aesthetic, photorealistic"],
|
| 44 |
+
["Astronaut riding a horse on Mars, cinematic lighting, sci-fi concept art, highly detailed"],
|
| 45 |
+
["Portrait of a wise old wizard with a long white beard, holding a glowing crystal staff, magical forest background"],
|
| 46 |
]
|
| 47 |
|
| 48 |
# Custom theme with modern aesthetics (Gradio 6)
|
|
|
|
| 65 |
# Header
|
| 66 |
gr.Markdown(
|
| 67 |
"""
|
| 68 |
+
# 🎨 Z-Image-Turbo
|
| 69 |
+
**Ultra-fast AI image generation** • Generate stunning images in just 8 steps
|
| 70 |
""",
|
| 71 |
elem_classes="header-text"
|
| 72 |
)
|
|
|
|
| 82 |
autofocus=True,
|
| 83 |
)
|
| 84 |
|
| 85 |
+
with gr.Accordion("⚙️ Advanced Settings", open=False):
|
| 86 |
with gr.Row():
|
| 87 |
height = gr.Slider(
|
| 88 |
minimum=512,
|
|
|
|
| 257 |
"gradio"
|
| 258 |
],
|
| 259 |
mcp_server=True
|
| 260 |
+
)
|
| 261 |
)
|