si.qian commited on
Commit
c7b656f
·
1 Parent(s): ba42db4
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -31,8 +31,10 @@ def run_rembg(img):
31
 
32
  return cropped_image
33
 
34
- def run_rembg_withmodel(img,model):
35
- output = remove(img)
 
 
36
  output_pil = Image.fromarray(output)
37
 
38
  # Remove margins
@@ -280,7 +282,7 @@ if __name__=="__main__":
280
 
281
  btn.click(
282
  fn=run_rembg_withmodel,
283
- inputs=[image_input, model_name]
284
  outputs=image_output,
285
  api_name="imageMattingWithModel"
286
  )
 
31
 
32
  return cropped_image
33
 
34
+ def run_rembg_withmodel(img, model):
35
+ model_name = model
36
+ session = new_session(model_name)
37
+ output = session.remove(input, session=session)
38
  output_pil = Image.fromarray(output)
39
 
40
  # Remove margins
 
282
 
283
  btn.click(
284
  fn=run_rembg_withmodel,
285
+ inputs=[image_input, model_name],
286
  outputs=image_output,
287
  api_name="imageMattingWithModel"
288
  )