Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -126,24 +126,20 @@ custom_css = """
|
|
| 126 |
}
|
| 127 |
"""
|
| 128 |
|
| 129 |
-
iface = gr.Interface(
|
| 130 |
-
fn=remove_background_wrapper,
|
| 131 |
-
inputs=gr.Image(type="numpy"),
|
| 132 |
-
outputs=[
|
| 133 |
-
gr.Image(type="pil", label="Foreground"),
|
| 134 |
-
gr.Image(type="pil", label="Background"),
|
| 135 |
-
gr.Image(type="pil", label="Foreground Mask"),
|
| 136 |
-
gr.Image(type="pil", label="Background Mask")
|
| 137 |
-
],
|
| 138 |
-
allow_flagging="never",
|
| 139 |
-
css=custom_css,
|
| 140 |
-
live=False
|
| 141 |
-
)
|
| 142 |
-
|
| 143 |
-
# Assigning an ID to the submit button
|
| 144 |
with gr.Blocks(css=custom_css) as demo:
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
}
|
| 127 |
"""
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
with gr.Blocks(css=custom_css) as demo:
|
| 130 |
+
# Interface setup with input and output
|
| 131 |
+
with gr.Row():
|
| 132 |
+
with gr.Column():
|
| 133 |
+
image_input = gr.Image(type="numpy", label="Upload Image")
|
| 134 |
+
btn = gr.Button("Submit", elem_id="submit-button")
|
| 135 |
+
with gr.Column():
|
| 136 |
+
output_foreground = gr.Image(type="pil", label="Foreground")
|
| 137 |
+
output_background = gr.Image(type="pil", label="Background")
|
| 138 |
+
output_foreground_mask = gr.Image(type="pil", label="Foreground Mask")
|
| 139 |
+
output_background_mask = gr.Image(type="pil", label="Background Mask")
|
| 140 |
+
|
| 141 |
+
# Link the button to the processing function
|
| 142 |
+
btn.click(fn=remove_background_wrapper, inputs=image_input, outputs=[
|
| 143 |
+
output_foreground, output_background, output_foreground_mask, output_background_mask])
|
| 144 |
+
|
| 145 |
+
demo.launch(debug=True)
|