innoai commited on
Commit
e8176ca
1 Parent(s): ffc7966

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -16,15 +16,15 @@ def remove_background(image):
16
  else:
17
  raise TypeError("Unsupported image type")
18
 
19
- # Ensure the output image has a transparent background and is saved in PNG format
20
- with io.BytesIO() as output_bytes:
21
- output.save(output_bytes, format="PNG")
22
- output_bytes.seek(0)
23
- output = Image.open(output_bytes)
24
 
25
  return output
26
 
27
- # Interface setup
28
  iface = gr.Interface(
29
  fn=remove_background,
30
  inputs=gr.Image(label="Upload Image"),
 
16
  else:
17
  raise TypeError("Unsupported image type")
18
 
19
+ # 确保输出图片的背景是透明的,并以PNG格式保存
20
+ output_bytes = io.BytesIO()
21
+ output.save(output_bytes, format="PNG")
22
+ output_bytes.seek(0)
23
+ output = Image.open(output_bytes)
24
 
25
  return output
26
 
27
+ # 界面设置
28
  iface = gr.Interface(
29
  fn=remove_background,
30
  inputs=gr.Image(label="Upload Image"),