John6666 commited on
Commit
91577c9
·
verified ·
1 Parent(s): a1b31a2

Upload dc.py

Browse files
Files changed (1) hide show
  1. dc.py +43 -1
dc.py CHANGED
@@ -501,9 +501,51 @@ class GuiSD:
501
  self.model.pipe.transformer.to(self.model.device)
502
  print("transformer to cuda")
503
 
504
- return self.infer_short(self.model, pipe_params), info_state
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  ## END MOD
506
 
 
 
 
 
507
 
508
  def dynamic_gpu_duration(func, duration, *args):
509
 
 
501
  self.model.pipe.transformer.to(self.model.device)
502
  print("transformer to cuda")
503
 
504
+ #return self.infer_short(self.model, pipe_params), info_state
505
+
506
+ actual_progress = 0
507
+ info_images = gr.update()
508
+ for img, seed, image_path, metadata in self.model(**pipe_params):
509
+ info_state = progress_step_bar(actual_progress, steps)
510
+ actual_progress += concurrency
511
+ if image_path:
512
+ info_images = f"Seeds: {str(seed)}"
513
+ if vae_msg:
514
+ info_images = info_images + "<br>" + vae_msg
515
+
516
+ if "Cannot copy out of meta tensor; no data!" in self.model.last_lora_error:
517
+ msg_ram = "Unable to process the LoRAs due to high RAM usage; please try again later."
518
+ print(msg_ram)
519
+ msg_lora += f"<br>{msg_ram}"
520
+
521
+ for status, lora in zip(self.model.lora_status, self.model.lora_memory):
522
+ if status:
523
+ msg_lora += f"<br>Loaded: {lora}"
524
+ elif status is not None:
525
+ msg_lora += f"<br>Error with: {lora}"
526
+
527
+ if msg_lora:
528
+ info_images += msg_lora
529
+
530
+ info_images = info_images + "<br>" + "GENERATION DATA:<br>" + metadata[0].replace("\n", "<br>") + "<br>-------<br>"
531
+
532
+ download_links = "<br>".join(
533
+ [
534
+ f'<a href="{path.replace("/images/", "/file=/home/user/app/images/")}" download="{os.path.basename(path)}">Download Image {i + 1}</a>'
535
+ for i, path in enumerate(image_path)
536
+ ]
537
+ )
538
+ if save_generated_images:
539
+ info_images += f"<br>{download_links}"
540
+
541
+ ## BEGIN MOD
542
+ img = save_images(img, metadata)
543
  ## END MOD
544
 
545
+ info_state = "COMPLETE"
546
+
547
+ #yield info_state, img, info_images
548
+ return img, info_state
549
 
550
  def dynamic_gpu_duration(func, duration, *args):
551