Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,24 +93,15 @@ with gr.Blocks() as demo:
|
|
| 93 |
with gr.Row():
|
| 94 |
with gr.Column(scale=1):
|
| 95 |
input_image = gr.Image(type="numpy", label="Upload Image")
|
| 96 |
-
process_btn = gr.Button("Remove Background", variant="primary")
|
| 97 |
|
| 98 |
with gr.Column(scale=1):
|
| 99 |
output_image = gr.Image(type="numpy", label="Result")
|
| 100 |
-
download_btn = gr.File(label="Download Image")
|
| 101 |
|
| 102 |
# Set up example images
|
| 103 |
gr.Examples(examples, inputs=input_image)
|
| 104 |
|
| 105 |
-
#
|
| 106 |
-
process_btn.click(
|
| 107 |
-
fn=process,
|
| 108 |
-
inputs=input_image,
|
| 109 |
-
outputs=[output_image, download_btn],
|
| 110 |
-
show_progress="full"
|
| 111 |
-
)
|
| 112 |
-
|
| 113 |
-
# Also process automatically when image is uploaded
|
| 114 |
input_image.change(
|
| 115 |
fn=process,
|
| 116 |
inputs=input_image,
|
|
@@ -118,5 +109,14 @@ with gr.Blocks() as demo:
|
|
| 118 |
show_progress="full"
|
| 119 |
)
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
if __name__ == "__main__":
|
| 122 |
demo.launch(share=False)
|
|
|
|
| 93 |
with gr.Row():
|
| 94 |
with gr.Column(scale=1):
|
| 95 |
input_image = gr.Image(type="numpy", label="Upload Image")
|
|
|
|
| 96 |
|
| 97 |
with gr.Column(scale=1):
|
| 98 |
output_image = gr.Image(type="numpy", label="Result")
|
| 99 |
+
download_btn = gr.File(label="Download Processed Image", elem_id="download_button")
|
| 100 |
|
| 101 |
# Set up example images
|
| 102 |
gr.Examples(examples, inputs=input_image)
|
| 103 |
|
| 104 |
+
# Process automatically when image is uploaded
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
input_image.change(
|
| 106 |
fn=process,
|
| 107 |
inputs=input_image,
|
|
|
|
| 109 |
show_progress="full"
|
| 110 |
)
|
| 111 |
|
| 112 |
+
# Style to ensure download button is visible
|
| 113 |
+
gr.HTML("""
|
| 114 |
+
<style>
|
| 115 |
+
#download_button {
|
| 116 |
+
margin-top: 10px;
|
| 117 |
+
}
|
| 118 |
+
</style>
|
| 119 |
+
""")
|
| 120 |
+
|
| 121 |
if __name__ == "__main__":
|
| 122 |
demo.launch(share=False)
|