NightRaven109 commited on
Commit
334e1bf
·
verified ·
1 Parent(s): 877f3e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -105,7 +105,7 @@ def process_image(
105
  tile_diffusion_stride=None,
106
  start_steps=999,
107
  start_point='lr',
108
- use_vae_encode_condition=False,
109
  sample_times=1
110
  )
111
 
@@ -138,6 +138,10 @@ def process_image(
138
  # Generate image
139
  with torch.no_grad():
140
  try:
 
 
 
 
141
  inference_time, output = pipeline(
142
  args.t_max,
143
  args.t_min,
@@ -155,7 +159,7 @@ def process_image(
155
  conditioning_scale=args.conditioning_scale,
156
  start_steps=args.start_steps,
157
  start_point=args.start_point,
158
- use_vae_encode_condition=args.use_vae_encode_condition,
159
  )
160
  except Exception as e:
161
  print(f"Pipeline execution error: {str(e)}")
@@ -180,6 +184,7 @@ def process_image(
180
  traceback.print_exc()
181
  return None
182
 
 
183
  # Create Gradio interface
184
  demo = gr.Interface(
185
  fn=process_image,
 
105
  tile_diffusion_stride=None,
106
  start_steps=999,
107
  start_point='lr',
108
+ use_vae_encode_condition=True, # Changed to True
109
  sample_times=1
110
  )
111
 
 
138
  # Generate image
139
  with torch.no_grad():
140
  try:
141
+ # First encode the image with VAE
142
+ image_tensor = pipeline.image_processor.preprocess(validation_image)
143
+ image_tensor = image_tensor.unsqueeze(0).to(device="cuda", dtype=torch.float32)
144
+
145
  inference_time, output = pipeline(
146
  args.t_max,
147
  args.t_min,
 
159
  conditioning_scale=args.conditioning_scale,
160
  start_steps=args.start_steps,
161
  start_point=args.start_point,
162
+ use_vae_encode_condition=True, # Set to True
163
  )
164
  except Exception as e:
165
  print(f"Pipeline execution error: {str(e)}")
 
184
  traceback.print_exc()
185
  return None
186
 
187
+
188
  # Create Gradio interface
189
  demo = gr.Interface(
190
  fn=process_image,