Ashoka74 commited on
Commit
48416d0
1 Parent(s): 022cb8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -503,6 +503,14 @@ def process(input_fg, prompt, image_width, image_height, num_samples, seed, step
503
 
504
  return pixels
505
 
 
 
 
 
 
 
 
 
506
  @torch.inference_mode()
507
  def process_bg(input_fg, input_bg, prompt, image_width, image_height, num_samples, seed, steps, a_prompt, n_prompt, cfg, highres_scale, highres_denoise, bg_source):
508
  clear_memory()
 
503
 
504
  return pixels
505
 
506
+ def extract_foreground(image):
507
+ if image is None:
508
+ return None, gr.update(visible=True), gr.update(visible=True)
509
+ result, rgba = run_rmbg(image)
510
+ mask_mover.set_extracted_fg(rgba)
511
+
512
+ return result, gr.update(visible=True), gr.update(visible=True)
513
+
514
  @torch.inference_mode()
515
  def process_bg(input_fg, input_bg, prompt, image_width, image_height, num_samples, seed, steps, a_prompt, n_prompt, cfg, highres_scale, highres_denoise, bg_source):
516
  clear_memory()