not-lain commited on
Commit
e7bef73
·
1 Parent(s): 7c4ce2a

update script

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -22,8 +22,10 @@ transform_image = transforms.Compose(
22
 
23
 
24
  @spaces.GPU
25
- def rmbg(image):
26
- image = load_img().convert("RGB")
 
 
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=["text"], outputs=["image"], api_name="rmbg")
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],