Kvikontent commited on
Commit
116b876
·
verified ·
1 Parent(s): 158eae5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -4,23 +4,18 @@ from PIL import Image
4
  import io
5
 
6
  def background_remover(input_image):
7
- output_img = remove(input_image) # Directly use the PIL Image object
8
-
9
- buf = io.BytesIO()
10
- output_img.save(buf, format='PNG')
11
- buf.seek(0)
12
- return buf
13
-
14
 
15
  description = """
16
  This app uses the rembg library to remove the background from uploaded images.
17
  Simply upload your image and let the model do its work. Download the result immediately after!
18
  """
19
 
20
- # Create the Gradio interface
21
  iface = gr.Interface(
22
  fn=background_remover,
23
- inputs=gr.Image(type='pil', label="Upload Image"),
24
  outputs="image",
25
  examples=["woman.jpg", "groot.jpg"],
26
  title="Background Remover",
 
4
  import io
5
 
6
  def background_remover(input_image):
7
+ output_img = remove(input_image) # Remove the background using the rembg library
8
+ # No need to convert to BytesIO, just return the PIL Image object
9
+ return output_img
 
 
 
 
10
 
11
  description = """
12
  This app uses the rembg library to remove the background from uploaded images.
13
  Simply upload your image and let the model do its work. Download the result immediately after!
14
  """
15
 
 
16
  iface = gr.Interface(
17
  fn=background_remover,
18
+ inputs=gr.inputs.Image(type='pil', label="Upload Image"),
19
  outputs="image",
20
  examples=["woman.jpg", "groot.jpg"],
21
  title="Background Remover",