app.py
CHANGED
@@ -29,7 +29,7 @@ def fn(image):
|
|
29 |
|
30 |
name_path = "output.png"
|
31 |
processed_image.save(name_path)
|
32 |
-
return (
|
33 |
|
34 |
@spaces.GPU
|
35 |
def process(image):
|
@@ -58,18 +58,20 @@ image_upload = gr.Image(label="Upload an image")
|
|
58 |
image_file_upload = gr.Image(label="Upload an image", type="filepath")
|
59 |
url_input = gr.Textbox(label="Paste an image URL")
|
60 |
output_file = gr.File(label="Output PNG File")
|
61 |
-
|
62 |
|
63 |
# Example images
|
64 |
chameleon = load_img("butterfly.jpg", output_type="pil")
|
65 |
url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
66 |
|
67 |
-
tab1 = gr.Interface(fn, inputs=image_upload, outputs= slider1, examples=[chameleon], api_name="image")
|
68 |
tab2 = gr.Interface(fn, inputs=url_input, outputs=slider2, examples=[url_example], api_name="text")
|
69 |
-
tab3 = gr.Interface(process_file, inputs=image_file_upload, outputs=output_file, examples=["butterfly.jpg"], api_name="png")
|
70 |
|
71 |
demo = gr.TabbedInterface(
|
72 |
-
[tab1, tab2, tab3], ["Image Upload", "URL Input", "File Output"], title="Background Removal Tool"
|
|
|
|
|
73 |
)
|
74 |
|
75 |
if __name__ == "__main__":
|
|
|
29 |
|
30 |
name_path = "output.png"
|
31 |
processed_image.save(name_path)
|
32 |
+
return (origin, name_path)
|
33 |
|
34 |
@spaces.GPU
|
35 |
def process(image):
|
|
|
58 |
image_file_upload = gr.Image(label="Upload an image", type="filepath")
|
59 |
url_input = gr.Textbox(label="Paste an image URL")
|
60 |
output_file = gr.File(label="Output PNG File")
|
61 |
+
download_button = gr.File(label="Download")
|
62 |
|
63 |
# Example images
|
64 |
chameleon = load_img("butterfly.jpg", output_type="pil")
|
65 |
url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
66 |
|
67 |
+
tab1 = gr.Interface(fn, inputs=image_upload, outputs= [slider1 , download_button], examples=[chameleon], api_name="image")
|
68 |
tab2 = gr.Interface(fn, inputs=url_input, outputs=slider2, examples=[url_example], api_name="text")
|
69 |
+
#tab3 = gr.Interface(process_file, inputs=image_file_upload, outputs=output_file, examples=["butterfly.jpg"], api_name="png")
|
70 |
|
71 |
demo = gr.TabbedInterface(
|
72 |
+
#[tab1, tab2, tab3], ["Image Upload", "URL Input", "File Output"], title="Background Removal Tool"
|
73 |
+
[tab1, tab2], ["Image Input", "URL Input"], title="Background Removal Pro"
|
74 |
+
|
75 |
)
|
76 |
|
77 |
if __name__ == "__main__":
|