Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import cv2
|
4 |
-
import numpy as np
|
5 |
|
6 |
def inference(file, mask, model, alpha_influence, segmentation_strength):
|
7 |
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
@@ -21,15 +20,15 @@ def inference(file, mask, model, alpha_influence, segmentation_strength):
|
|
21 |
input,
|
22 |
session=new_session(model),
|
23 |
only_mask=(True if mask == "Mask only" else False),
|
24 |
-
alpha=alpha_influence,
|
25 |
-
bg_color=(0, 0, 0, segmentation_strength)
|
26 |
)
|
27 |
o.write(output)
|
28 |
m.write(output)
|
29 |
|
30 |
return os.path.join("output.png"), os.path.join("mask.png")
|
31 |
|
32 |
-
title = "
|
33 |
description = "Gradio demo for RemBG. To use it, simply upload your image and adjust the alpha influence and segmentation strength."
|
34 |
article = "<p style='text-align: center;'><a href='https://github.com/danielgatis/rembg' target='_blank'>Github Repo</a></p>"
|
35 |
|
@@ -82,5 +81,6 @@ iface = gr.Interface(
|
|
82 |
enable_queue=True
|
83 |
)
|
84 |
|
85 |
-
iface.launch(
|
|
|
86 |
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import cv2
|
|
|
4 |
|
5 |
def inference(file, mask, model, alpha_influence, segmentation_strength):
|
6 |
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
|
|
20 |
input,
|
21 |
session=new_session(model),
|
22 |
only_mask=(True if mask == "Mask only" else False),
|
23 |
+
alpha=alpha_influence,
|
24 |
+
bg_color=(0, 0, 0, segmentation_strength)
|
25 |
)
|
26 |
o.write(output)
|
27 |
m.write(output)
|
28 |
|
29 |
return os.path.join("output.png"), os.path.join("mask.png")
|
30 |
|
31 |
+
title = "RemBG_Super"
|
32 |
description = "Gradio demo for RemBG. To use it, simply upload your image and adjust the alpha influence and segmentation strength."
|
33 |
article = "<p style='text-align: center;'><a href='https://github.com/danielgatis/rembg' target='_blank'>Github Repo</a></p>"
|
34 |
|
|
|
81 |
enable_queue=True
|
82 |
)
|
83 |
|
84 |
+
iface.launch()
|
85 |
+
|
86 |
|