Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
-
|
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,8 +21,8 @@ def inference(file, mask, model, alpha_influence, segmentation_strength):
|
|
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)
|
@@ -71,8 +72,8 @@ iface = gr.Interface(
|
|
71 |
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.5, label="Segmentation Strength"),
|
72 |
],
|
73 |
[
|
74 |
-
gr.outputs.Image(type="plot", label="Processed Image"),
|
75 |
-
gr.outputs.Image(type="plot", label="Processed Mask"),
|
76 |
],
|
77 |
title=title,
|
78 |
description=description,
|
@@ -82,3 +83,4 @@ iface = gr.Interface(
|
|
82 |
)
|
83 |
|
84 |
iface.launch()
|
|
|
|
1 |
+
iimport 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 |
input,
|
22 |
session=new_session(model),
|
23 |
only_mask=(True if mask == "Mask only" else False),
|
24 |
+
alpha=alpha_influence, # Control de influencia del canal alfa
|
25 |
+
bg_color=(0, 0, 0, segmentation_strength) # Control de fuerza de segmentación
|
26 |
)
|
27 |
o.write(output)
|
28 |
m.write(output)
|
|
|
72 |
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.5, label="Segmentation Strength"),
|
73 |
],
|
74 |
[
|
75 |
+
gr.outputs.Image(type="plot", label="Processed Image", output=show_processed_image),
|
76 |
+
gr.outputs.Image(type="plot", label="Processed Mask", output=show_processed_mask),
|
77 |
],
|
78 |
title=title,
|
79 |
description=description,
|
|
|
83 |
)
|
84 |
|
85 |
iface.launch()
|
86 |
+
|