Janeka commited on
Commit
8a5d4cf
·
verified ·
1 Parent(s): ba74bfc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -3,16 +3,15 @@ from rembg import remove
3
  from PIL import Image
4
 
5
  def remove_bg(image):
6
- output_image = remove(image)
7
- return output_image
8
 
9
- # Create Gradio interface
10
- demo = gr.Interface(
11
- fn=remove_bg,
12
- inputs=gr.Image(type="pil"), # Accept PIL images
13
- outputs="image", # Output as an image
14
- )
 
15
 
16
- # Launch the app
17
  if __name__ == "__main__":
18
- demo.launch(share=True)
 
3
  from PIL import Image
4
 
5
  def remove_bg(image):
6
+ return remove(image)
 
7
 
8
+ with gr.Blocks() as demo:
9
+ gr.Markdown("## U²Net Background Remover API")
10
+ with gr.Row():
11
+ inp = gr.Image(type="pil")
12
+ out = gr.Image()
13
+ submit = gr.Button("Remove Background")
14
+ submit.click(remove_bg, inputs=inp, outputs=out)
15
 
 
16
  if __name__ == "__main__":
17
+ demo.launch()