Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -81,17 +81,16 @@ NUM_IMAGES_PER_PROMPT = 1
|
|
81 |
pipe = PixArtAlphaPipeline.from_pretrained(
|
82 |
"PixArt-alpha/PixArt-LCM-XL-2-1024-MS",
|
83 |
torch_dtype=torch.float16,
|
84 |
-
use_safetensors=True
|
85 |
-
|
|
|
|
|
86 |
|
87 |
def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
|
88 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|
89 |
if not negative:
|
90 |
negative = ""
|
91 |
return p.replace("{prompt}", positive), n + negative
|
92 |
-
|
93 |
-
# speed-up T5
|
94 |
-
pipe.text_encoder.to_bettertransformer()
|
95 |
|
96 |
if USE_TORCH_COMPILE:
|
97 |
pipe.transformer = torch.compile(pipe.transformer, mode="reduce-overhead", fullgraph=True)
|
@@ -149,6 +148,7 @@ def generate(
|
|
149 |
examples = [
|
150 |
"A Monkey with a happy face in the Sahara desert.",
|
151 |
"Eiffel Tower was Made up of ICE.",
|
|
|
152 |
"Color photo of a corgi made of transparent glass, standing on the riverside in Yosemite National Park.",
|
153 |
"A close-up photo of a woman. She wore a blue coat with a gray dress underneath and has blue eyes.",
|
154 |
"A litter of golden retriever puppies playing in the snow. Their heads pop out of the snow, covered in.",
|
@@ -225,7 +225,7 @@ with gr.Blocks(css=css) as demo:
|
|
225 |
minimum=4,
|
226 |
maximum=20,
|
227 |
step=1,
|
228 |
-
value=
|
229 |
)
|
230 |
|
231 |
gr.Examples(
|
|
|
81 |
pipe = PixArtAlphaPipeline.from_pretrained(
|
82 |
"PixArt-alpha/PixArt-LCM-XL-2-1024-MS",
|
83 |
torch_dtype=torch.float16,
|
84 |
+
use_safetensors=True).to(device)
|
85 |
+
|
86 |
+
pipe.vae = ConsistencyDecoderVAE.from_pretrained("openai/consistency-decoder", torch_dtype=torch.float16)
|
87 |
+
pipe.text_encoder.to_bettertransformer()
|
88 |
|
89 |
def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
|
90 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|
91 |
if not negative:
|
92 |
negative = ""
|
93 |
return p.replace("{prompt}", positive), n + negative
|
|
|
|
|
|
|
94 |
|
95 |
if USE_TORCH_COMPILE:
|
96 |
pipe.transformer = torch.compile(pipe.transformer, mode="reduce-overhead", fullgraph=True)
|
|
|
148 |
examples = [
|
149 |
"A Monkey with a happy face in the Sahara desert.",
|
150 |
"Eiffel Tower was Made up of ICE.",
|
151 |
+
"photo of 8k ultra realistic harbour, nreal engine 5, port, boats, sunset, beautiful light, full of colour, cinematic lighting, battered, trending on artstation, 4k, hyperrealistic, focused, extreme details",
|
152 |
"Color photo of a corgi made of transparent glass, standing on the riverside in Yosemite National Park.",
|
153 |
"A close-up photo of a woman. She wore a blue coat with a gray dress underneath and has blue eyes.",
|
154 |
"A litter of golden retriever puppies playing in the snow. Their heads pop out of the snow, covered in.",
|
|
|
225 |
minimum=4,
|
226 |
maximum=20,
|
227 |
step=1,
|
228 |
+
value=8,
|
229 |
)
|
230 |
|
231 |
gr.Examples(
|