Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,22 +17,14 @@ def remove_background(input_image):
|
|
17 |
input_image = gr.inputs.Image(type="filepath", label="Input Image")
|
18 |
output_image = gr.inputs.Image(type="filepath", label="Output Image")
|
19 |
|
20 |
-
# define function for downloading output image
|
21 |
-
def download_output(output_image):
|
22 |
-
output_image.save("output.png")
|
23 |
-
with open("output.png", "rb") as f:
|
24 |
-
img_bytes = BytesIO(f.read())
|
25 |
-
return img_bytes
|
26 |
|
27 |
-
|
28 |
-
output_image_download = gr.inputs.Button(label="Download Output", type="bytes", callback=download_output)
|
29 |
|
30 |
# create the interface
|
31 |
iface = gr.Interface(
|
32 |
fn=remove_background,
|
33 |
inputs=input_image,
|
34 |
outputs=output_image,
|
35 |
-
output_options=[output_image_download],
|
36 |
title='Image Background Remover',
|
37 |
description='Upload an image and it will remove.'
|
38 |
)
|
|
|
17 |
input_image = gr.inputs.Image(type="filepath", label="Input Image")
|
18 |
output_image = gr.inputs.Image(type="filepath", label="Output Image")
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
|
|
|
22 |
|
23 |
# create the interface
|
24 |
iface = gr.Interface(
|
25 |
fn=remove_background,
|
26 |
inputs=input_image,
|
27 |
outputs=output_image,
|
|
|
28 |
title='Image Background Remover',
|
29 |
description='Upload an image and it will remove.'
|
30 |
)
|