Janeka commited on
Commit
ab33d6c
·
verified ·
1 Parent(s): 67a8e7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
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
- demo = gr.Interface(
20
- fn=remove_bg,
21
- inputs=gr.Image(type="pil"), # Accept PIL images
22
- outputs="image", # Output as an image
23
- )
 
24
 
25
- # Wrap the Gradio app in the Flask app
26
- @app.route("/", methods=["GET", "POST"])
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__":