not-lain commited on
Commit
2e133a7
·
verified ·
1 Parent(s): 3231e76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -38,21 +38,20 @@ def fn(image):
38
  mask = pred_pil.resize(image_size)
39
  image.putalpha(mask)
40
  # return (image, origin)
41
- return image
 
42
 
43
 
44
- # slider1 = ImageSlider(label="birefnet", type="pil")
45
  img1 = gr.Image(type= "pil", image_mode="RGBA")
46
- slider2 = ImageSlider(label="birefnet", type="pil")
47
  image = gr.Image(label="Upload an image")
48
- text = gr.Textbox(label="Paste an image URL")
49
 
50
 
51
  chameleon = load_img("chameleon.jpg", output_type="pil")
52
 
53
  url = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
54
  demo = gr.Interface(
55
- fn, inputs=image, outputs=img1, examples=[chameleon], api_name="image"
56
  )
57
 
58
  # tab2 = gr.Interface(fn, inputs=text, outputs=slider2, examples=[url], api_name="text")
 
38
  mask = pred_pil.resize(image_size)
39
  image.putalpha(mask)
40
  # return (image, origin)
41
+ image.save("img.png","PNG")
42
+ return (image , "img.png")
43
 
44
 
 
45
  img1 = gr.Image(type= "pil", image_mode="RGBA")
 
46
  image = gr.Image(label="Upload an image")
47
+ file = gr.File()
48
 
49
 
50
  chameleon = load_img("chameleon.jpg", output_type="pil")
51
 
52
  url = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
53
  demo = gr.Interface(
54
+ fn, inputs=image, outputs=[img1,file], examples=[chameleon], api_name="image"
55
  )
56
 
57
  # tab2 = gr.Interface(fn, inputs=text, outputs=slider2, examples=[url], api_name="text")