Lawrence-cj commited on
Commit
5ecd0a6
1 Parent(s): 3f3a332

update app.py

Browse files
Files changed (2) hide show
  1. app.py +6 -1
  2. pixart-lcm.png +0 -0
app.py CHANGED
@@ -9,7 +9,7 @@ import random
9
  import gradio as gr
10
  import numpy as np
11
  import uuid
12
- from diffusers import PixArtAlphaPipeline, LCMScheduler
13
  import torch
14
  from typing import Tuple
15
  from datetime import datetime
@@ -109,6 +109,10 @@ if torch.cuda.is_available():
109
  use_safetensors=True,
110
  )
111
 
 
 
 
 
112
  if ENABLE_CPU_OFFLOAD:
113
  pipe.enable_model_cpu_offload()
114
  else:
@@ -160,6 +164,7 @@ def generate(
160
 
161
  images = pipe(
162
  prompt=prompt,
 
163
  width=width,
164
  height=height,
165
  guidance_scale=0.,
 
9
  import gradio as gr
10
  import numpy as np
11
  import uuid
12
+ from diffusers import PixArtAlphaPipeline, LatentConsistencyModelPipeline, LCMScheduler
13
  import torch
14
  from typing import Tuple
15
  from datetime import datetime
 
109
  use_safetensors=True,
110
  )
111
 
112
+ if os.getenv('CONSISTENCY_DECODER', False):
113
+ print("Using DALL-E 3 Consistency Decoder")
114
+ pipe.vae = ConsistencyDecoderVAE.from_pretrained("openai/consistency-decoder", torch_dtype=torch.float16)
115
+
116
  if ENABLE_CPU_OFFLOAD:
117
  pipe.enable_model_cpu_offload()
118
  else:
 
164
 
165
  images = pipe(
166
  prompt=prompt,
167
+ negative_prompt=negative_prompt,
168
  width=width,
169
  height=height,
170
  guidance_scale=0.,
pixart-lcm.png DELETED
Binary file (58.9 kB)