codic commited on
Commit
aacbfa5
·
verified ·
1 Parent(s): 6764fcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -27,8 +27,10 @@ def remove_background(image):
27
  img_bytes.seek(0)
28
 
29
  # Step 1: Remove background using the Gradio API
30
- result_url = background_removal_client.predict(f=img_bytes, api_name="/png")
31
-
 
 
32
  # Step 2: Download the image returned by the API
33
  response = requests.get(result_url)
34
  foreground = Image.open(BytesIO(response.content)).convert("RGBA")
 
27
  img_bytes.seek(0)
28
 
29
  # Step 1: Remove background using the Gradio API
30
+ result_url = background_removal_client.predict(
31
+ f=img_bytes.getvalue(), # Use getvalue() to get bytes
32
+ api_name="/png"
33
+ )
34
  # Step 2: Download the image returned by the API
35
  response = requests.get(result_url)
36
  foreground = Image.open(BytesIO(response.content)).convert("RGBA")