Spaces:
Sleeping
Sleeping
itzjunayed
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -50,18 +50,15 @@ def predict_segmentation(image):
|
|
50 |
# Create an alpha channel: 255 where there is segmentation, 0 otherwise
|
51 |
rgba_img[:, :, 3] = np.where(predicted_img_resized > 0, 255, 0)
|
52 |
|
53 |
-
# Convert the numpy array to an image and
|
54 |
output_image = Image.fromarray(rgba_img)
|
55 |
-
|
56 |
-
output_image.save(output_image_path)
|
57 |
-
|
58 |
-
return output_image_path
|
59 |
|
60 |
# Gradio Interface
|
61 |
iface = gr.Interface(
|
62 |
fn=predict_segmentation,
|
63 |
inputs="image",
|
64 |
-
outputs="
|
65 |
live=False
|
66 |
)
|
67 |
|
|
|
50 |
# Create an alpha channel: 255 where there is segmentation, 0 otherwise
|
51 |
rgba_img[:, :, 3] = np.where(predicted_img_resized > 0, 255, 0)
|
52 |
|
53 |
+
# Convert the numpy array to an image and return it
|
54 |
output_image = Image.fromarray(rgba_img)
|
55 |
+
return output_image
|
|
|
|
|
|
|
56 |
|
57 |
# Gradio Interface
|
58 |
iface = gr.Interface(
|
59 |
fn=predict_segmentation,
|
60 |
inputs="image",
|
61 |
+
outputs="image",
|
62 |
live=False
|
63 |
)
|
64 |
|