Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,20 @@
|
|
| 1 |
import torch
|
| 2 |
import spaces
|
| 3 |
import gradio as gr
|
| 4 |
-
from diffusers import
|
| 5 |
|
| 6 |
# Load the pipeline once at startup
|
| 7 |
print("Loading Z-Image-Turbo pipeline...")
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"Tongyi-MAI/Z-Image-Turbo",
|
|
|
|
| 10 |
torch_dtype=torch.bfloat16,
|
| 11 |
-
low_cpu_mem_usage=False,
|
| 12 |
)
|
| 13 |
pipe.to("cuda")
|
| 14 |
|
|
@@ -65,8 +71,8 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 65 |
# Header
|
| 66 |
gr.Markdown(
|
| 67 |
"""
|
| 68 |
-
#
|
| 69 |
-
**Ultra-fast AI image generation**
|
| 70 |
""",
|
| 71 |
elem_classes="header-text"
|
| 72 |
)
|
|
@@ -104,7 +110,7 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 104 |
num_inference_steps = gr.Slider(
|
| 105 |
minimum=1,
|
| 106 |
maximum=20,
|
| 107 |
-
value=
|
| 108 |
step=1,
|
| 109 |
label="Inference Steps",
|
| 110 |
info="9 steps = 8 DiT forwards (recommended)"
|
|
|
|
| 1 |
import torch
|
| 2 |
import spaces
|
| 3 |
import gradio as gr
|
| 4 |
+
from diffusers import ZImagePipeline, ZImageTransformer2DModel
|
| 5 |
|
| 6 |
# Load the pipeline once at startup
|
| 7 |
print("Loading Z-Image-Turbo pipeline...")
|
| 8 |
+
transformer = ZImageTransformer2DModel.from_pretrained(
|
| 9 |
+
"linoyts/beyond-reality-z-image-diffusers",
|
| 10 |
+
torch_dtype=torch.bfloat16,
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
# Load pipeline with custom transformer
|
| 14 |
+
pipe = ZImagePipeline.from_pretrained(
|
| 15 |
"Tongyi-MAI/Z-Image-Turbo",
|
| 16 |
+
transformer=transformer,
|
| 17 |
torch_dtype=torch.bfloat16,
|
|
|
|
| 18 |
)
|
| 19 |
pipe.to("cuda")
|
| 20 |
|
|
|
|
| 71 |
# Header
|
| 72 |
gr.Markdown(
|
| 73 |
"""
|
| 74 |
+
# Z-Image-Turbo BEYOND REALITY
|
| 75 |
+
**Ultra-fast AI image generation** with [Nurburgring/BEYOND_REALITY_Z_IMAGE](https://huggingface.co/Nurburgring/BEYOND_REALITY_Z_IMAGE) - Z Image Turbo fine-tuned for enhanced texture fidelity, analog photography alignment & improved balance of realism & aesthetics.
|
| 76 |
""",
|
| 77 |
elem_classes="header-text"
|
| 78 |
)
|
|
|
|
| 110 |
num_inference_steps = gr.Slider(
|
| 111 |
minimum=1,
|
| 112 |
maximum=20,
|
| 113 |
+
value=10,
|
| 114 |
step=1,
|
| 115 |
label="Inference Steps",
|
| 116 |
info="9 steps = 8 DiT forwards (recommended)"
|