Update app.py
Browse files
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 |
-
|
|
|
|
| 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 |
-
|
| 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")
|