Spaces:
Build error
Build error
init
Browse files
app.py
CHANGED
@@ -91,9 +91,10 @@ net.eval()
|
|
91 |
|
92 |
def process(im):
|
93 |
image = modnet.segment(im.name)
|
94 |
-
|
|
|
95 |
|
96 |
-
img_name_list = [
|
97 |
print("Number of images: ", len(img_name_list))
|
98 |
# --------- 2. dataloader ---------
|
99 |
# 1. dataloader
|
@@ -134,7 +135,7 @@ def process(im):
|
|
134 |
|
135 |
print(results)
|
136 |
|
137 |
-
return Image.open(results[0])
|
138 |
|
139 |
title = "U-2-Net"
|
140 |
description = "Gradio demo for U-2-Net, https://github.com/xuebinqin/U-2-Net"
|
@@ -144,7 +145,7 @@ gr.Interface(
|
|
144 |
process,
|
145 |
[gr.inputs.Image(type="file", label="Input")
|
146 |
],
|
147 |
-
[gr.outputs.Image(type="pil", label="Output")
|
148 |
title=title,
|
149 |
description=description,
|
150 |
article=article,
|
|
|
91 |
|
92 |
def process(im):
|
93 |
image = modnet.segment(im.name)
|
94 |
+
im_path = os.path.abspath(os.path.basename(im.name))
|
95 |
+
Image.fromarray(np.uint8(image)).save(im_path)
|
96 |
|
97 |
+
img_name_list = [im_path]
|
98 |
print("Number of images: ", len(img_name_list))
|
99 |
# --------- 2. dataloader ---------
|
100 |
# 1. dataloader
|
|
|
135 |
|
136 |
print(results)
|
137 |
|
138 |
+
return Image.open(results[0])
|
139 |
|
140 |
title = "U-2-Net"
|
141 |
description = "Gradio demo for U-2-Net, https://github.com/xuebinqin/U-2-Net"
|
|
|
145 |
process,
|
146 |
[gr.inputs.Image(type="file", label="Input")
|
147 |
],
|
148 |
+
[gr.outputs.Image(type="pil", label="Output")],
|
149 |
title=title,
|
150 |
description=description,
|
151 |
article=article,
|