Spaces:
Running
Running
si.qian
commited on
Commit
·
c7b656f
1
Parent(s):
ba42db4
solve bug
Browse files
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 |
-
|
|
|
|
|
|
|
| 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 |
)
|