update script
Browse files
app.py
CHANGED
@@ -22,8 +22,10 @@ transform_image = transforms.Compose(
|
|
22 |
|
23 |
|
24 |
@spaces.GPU
|
25 |
-
def rmbg(image):
|
26 |
-
image
|
|
|
|
|
27 |
image_size = image.size
|
28 |
input_images = transform_image(image).unsqueeze(0).to("cuda")
|
29 |
# Prediction
|
@@ -36,7 +38,7 @@ def rmbg(image):
|
|
36 |
return image
|
37 |
|
38 |
|
39 |
-
rmbg_tab = gr.Interface(fn=rmbg, inputs=["
|
40 |
|
41 |
demo = gr.TabbedInterface(
|
42 |
[rmbg_tab],
|
|
|
22 |
|
23 |
|
24 |
@spaces.GPU
|
25 |
+
def rmbg(image,url):
|
26 |
+
if image is None :
|
27 |
+
image = url
|
28 |
+
image = load_img(image).convert("RGB")
|
29 |
image_size = image.size
|
30 |
input_images = transform_image(image).unsqueeze(0).to("cuda")
|
31 |
# Prediction
|
|
|
38 |
return image
|
39 |
|
40 |
|
41 |
+
rmbg_tab = gr.Interface(fn=rmbg, inputs=["image","url"], outputs=["image"], api_name="rmbg")
|
42 |
|
43 |
demo = gr.TabbedInterface(
|
44 |
[rmbg_tab],
|