Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,17 @@ transform_image = transforms.Compose(
|
|
20 |
]
|
21 |
)
|
22 |
|
|
|
|
|
|
|
|
|
23 |
def fn(image):
|
24 |
-
image_path = process_file(image)
|
25 |
im = load_img(image, output_type="pil")
|
26 |
im = im.convert("RGB")
|
27 |
origin = im.copy()
|
28 |
image = process(im)
|
|
|
|
|
29 |
return (image, origin), image_path
|
30 |
|
31 |
@spaces.GPU
|
@@ -70,7 +75,7 @@ tab3 = gr.Interface(process_file, inputs=image2, outputs=png_file, examples=["gi
|
|
70 |
|
71 |
|
72 |
demo = gr.TabbedInterface(
|
73 |
-
[tab1, tab2
|
74 |
)
|
75 |
|
76 |
if __name__ == "__main__":
|
|
|
20 |
]
|
21 |
)
|
22 |
|
23 |
+
output_folder = 'output_images'
|
24 |
+
if not os.path.exists(output_folder):
|
25 |
+
os.makedirs(output_folder)
|
26 |
+
|
27 |
def fn(image):
|
|
|
28 |
im = load_img(image, output_type="pil")
|
29 |
im = im.convert("RGB")
|
30 |
origin = im.copy()
|
31 |
image = process(im)
|
32 |
+
image_path = os.path.join(output_folder, "no_bg_image.png")
|
33 |
+
image.save(image_path)
|
34 |
return (image, origin), image_path
|
35 |
|
36 |
@spaces.GPU
|
|
|
75 |
|
76 |
|
77 |
demo = gr.TabbedInterface(
|
78 |
+
[tab1, tab2], ["input image", "input url"], title="RMBG-2.0 for background removal"
|
79 |
)
|
80 |
|
81 |
if __name__ == "__main__":
|