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 bg # Importa el módulo "bg.py"
|
5 |
|
6 |
def inference(file, mask, model, alpha_influence, segmentation_strength):
|
7 |
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
@@ -17,16 +16,16 @@ def inference(file, mask, model, alpha_influence, segmentation_strength):
|
|
17 |
input = i.read()
|
18 |
output = remove(
|
19 |
input,
|
20 |
-
session=
|
21 |
only_mask=(True if mask == "Mask only" else False),
|
22 |
-
|
23 |
-
|
24 |
)
|
25 |
|
26 |
o.write(output)
|
27 |
return os.path.join("output.png")
|
28 |
|
29 |
-
title = "
|
30 |
description = "Gradio demo for RemBG. To use it, simply upload your image and adjust the alpha influence and segmentation strength."
|
31 |
article = "<p style='text-align: center;'><a href='https://github.com/danielgatis/rembg' target='_blank'>Github Repo</a></p>"
|
32 |
|
|
|
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)
|
|
|
16 |
input = i.read()
|
17 |
output = remove(
|
18 |
input,
|
19 |
+
session=new_session(model),
|
20 |
only_mask=(True if mask == "Mask only" else False),
|
21 |
+
alpha=alpha_influence, # Control de influencia del canal alfa
|
22 |
+
bg_color=(0, 0, 0, segmentation_strength) # Control de fuerza de segmentación
|
23 |
)
|
24 |
|
25 |
o.write(output)
|
26 |
return os.path.join("output.png")
|
27 |
|
28 |
+
title = "RemBG_ Super"
|
29 |
description = "Gradio demo for RemBG. To use it, simply upload your image and adjust the alpha influence and segmentation strength."
|
30 |
article = "<p style='text-align: center;'><a href='https://github.com/danielgatis/rembg' target='_blank'>Github Repo</a></p>"
|
31 |
|