fffiloni commited on
Commit
52273d7
1 Parent(s): 9ba0acb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -182,7 +182,7 @@ def infer(ref_style_file, style_description, caption, progress):
182
  lam_style=1, lam_txt_alignment=1.0,
183
  use_ddim_sampler=True,
184
  )
185
- for (sampled_c, _, _) in progress.tqdm(tqdm(sampling_c, total=extras.sampling_configs['timesteps'])):
186
  #for i, (sampled_c, _, _) in enumerate(sampling_c, 1):
187
  # if i % 5 == 0: # Update progress every 5 steps
188
  # progress(0.4 + 0.3 * (i / extras.sampling_configs['timesteps']), f"Stage C reverse process: step {i}/{extras.sampling_configs['timesteps']}")
@@ -198,9 +198,10 @@ def infer(ref_style_file, style_description, caption, progress):
198
  models_b.generator, conditions_b, stage_b_latent_shape,
199
  unconditions_b, device=device, **extras_b.sampling_configs,
200
  )
201
- for i, (sampled_b, _, _) in enumerate(sampling_b, 1):
202
- if i % 1 == 0: # Update progress every 1 step
203
- progress(0.7 + 0.2 * (i / extras_b.sampling_configs['timesteps']), f"Stage B reverse process: step {i}/{extras_b.sampling_configs['timesteps']}")
 
204
  sampled_b = sampled_b
205
  sampled = models_b.stage_a.decode(sampled_b).float()
206
 
@@ -299,10 +300,11 @@ def infer_compo(style_description, ref_style_file, caption, ref_sub_file, progre
299
  sam_mask=sam_mask, use_sam_mask=use_sam_mask,
300
  sam_prompt=sam_prompt
301
  )
302
-
303
- for i, (sampled_c, _, _) in enumerate(sampling_c, 1):
304
- if i % 5 == 0: # Update progress every 5 steps
305
- progress(0.4 + 0.3 * (i / extras.sampling_configs['timesteps']), f"Stage C reverse process: step {i}/{extras.sampling_configs['timesteps']}")
 
306
  sampled_c = sampled_c
307
 
308
  progress(0.7, "Starting Stage B reverse process")
@@ -315,9 +317,10 @@ def infer_compo(style_description, ref_style_file, caption, ref_sub_file, progre
315
  models_b.generator, conditions_b, stage_b_latent_shape,
316
  unconditions_b, device=device, **extras_b.sampling_configs,
317
  )
318
- for i, (sampled_b, _, _) in enumerate(sampling_b, 1):
319
- if i % 5 == 0: # Update progress every 5 steps
320
- progress(0.7 + 0.2 * (i / extras_b.sampling_configs['timesteps']), f"Stage B reverse process: step {i}/{extras_b.sampling_configs['timesteps']}")
 
321
  sampled_b = sampled_b
322
  sampled = models_b.stage_a.decode(sampled_b).float()
323
 
 
182
  lam_style=1, lam_txt_alignment=1.0,
183
  use_ddim_sampler=True,
184
  )
185
+ for (sampled_c, _, _) in progress.tqdm(tqdm(sampling_c, total=extras.sampling_configs['timesteps']), desc="Stage C reverse process"):
186
  #for i, (sampled_c, _, _) in enumerate(sampling_c, 1):
187
  # if i % 5 == 0: # Update progress every 5 steps
188
  # progress(0.4 + 0.3 * (i / extras.sampling_configs['timesteps']), f"Stage C reverse process: step {i}/{extras.sampling_configs['timesteps']}")
 
198
  models_b.generator, conditions_b, stage_b_latent_shape,
199
  unconditions_b, device=device, **extras_b.sampling_configs,
200
  )
201
+ for sampled_b, _, _ in progress.tqdm(tqdm(sampling_b, total=extras_b.sampling_configs['timesteps']), desc="Stage B reverse process"):
202
+ #for i, (sampled_b, _, _) in enumerate(sampling_b, 1):
203
+ # if i % 1 == 0: # Update progress every 1 step
204
+ # progress(0.7 + 0.2 * (i / extras_b.sampling_configs['timesteps']), f"Stage B reverse process: step {i}/{extras_b.sampling_configs['timesteps']}")
205
  sampled_b = sampled_b
206
  sampled = models_b.stage_a.decode(sampled_b).float()
207
 
 
300
  sam_mask=sam_mask, use_sam_mask=use_sam_mask,
301
  sam_prompt=sam_prompt
302
  )
303
+
304
+ for sampled_c, _, _ in progress.tqdm(tqdm(sampling_c, total=extras.sampling_configs['timesteps']), desc="Stage C reverse process"):
305
+ #for i, (sampled_c, _, _) in enumerate(sampling_c, 1):
306
+ # if i % 5 == 0: # Update progress every 5 steps
307
+ # progress(0.4 + 0.3 * (i / extras.sampling_configs['timesteps']), f"Stage C reverse process: step {i}/{extras.sampling_configs['timesteps']}")
308
  sampled_c = sampled_c
309
 
310
  progress(0.7, "Starting Stage B reverse process")
 
317
  models_b.generator, conditions_b, stage_b_latent_shape,
318
  unconditions_b, device=device, **extras_b.sampling_configs,
319
  )
320
+ for sampled_b, _, _ in progress.tqdm(tqdm(sampling_b, total=extras_b.sampling_configs['timesteps']), desc="Stage B reverse process"):
321
+ #for i, (sampled_b, _, _) in enumerate(sampling_b, 1):
322
+ # if i % 5 == 0: # Update progress every 5 steps
323
+ # progress(0.7 + 0.2 * (i / extras_b.sampling_configs['timesteps']), f"Stage B reverse process: step {i}/{extras_b.sampling_configs['timesteps']}")
324
  sampled_b = sampled_b
325
  sampled = models_b.stage_a.decode(sampled_b).float()
326