Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,17 +15,16 @@ def remove_bg(image):
|
|
| 15 |
output_image = remove(image)
|
| 16 |
return output_image
|
| 17 |
|
| 18 |
-
# Create Gradio interface
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
def gradio_interface():
|
| 28 |
-
return demo.launch(share=True, server_name="0.0.0.0", server_port=7860)
|
| 29 |
|
| 30 |
# Run the Flask app
|
| 31 |
if __name__ == "__main__":
|
|
|
|
| 15 |
output_image = remove(image)
|
| 16 |
return output_image
|
| 17 |
|
| 18 |
+
# Create Gradio interface using Blocks
|
| 19 |
+
with gr.Blocks() as demo:
|
| 20 |
+
gr.Interface(
|
| 21 |
+
fn=remove_bg,
|
| 22 |
+
inputs=gr.Image(type="pil"), # Accept PIL images
|
| 23 |
+
outputs="image", # Output as an image
|
| 24 |
+
)
|
| 25 |
|
| 26 |
+
# Mount the Gradio app at the root path
|
| 27 |
+
app = gr.mount_gradio_app(app, demo, path="/")
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# Run the Flask app
|
| 30 |
if __name__ == "__main__":
|