Spaces:
Running
on
Zero
Running
on
Zero
parokshsaxena
commited on
Commit
β’
b608c7b
1
Parent(s):
5b0a64b
using full image output from remove bg, else it's reducing the size
Browse files
src/background_processor.py
CHANGED
@@ -212,12 +212,16 @@ class BackgroundProcessor:
|
|
212 |
"image_file": ('foreground.png', foreground_binary, 'image/png'),
|
213 |
"bg_image_file": ('background.png', background_binary, 'image/png')
|
214 |
}
|
215 |
-
|
|
|
|
|
|
|
|
|
216 |
headers = {
|
217 |
"accept": "image/*",
|
218 |
'X-Api-Key': REMOVE_BG_KEY
|
219 |
}
|
220 |
-
remove_bg_request = requests.post(url, files=files,headers=headers, timeout=20)
|
221 |
if remove_bg_request.status_code == 200:
|
222 |
image_content = remove_bg_request.content
|
223 |
pil_image = ImageFormatConvertor.binary_data_to_pil_image(image_content)
|
|
|
212 |
"image_file": ('foreground.png', foreground_binary, 'image/png'),
|
213 |
"bg_image_file": ('background.png', background_binary, 'image/png')
|
214 |
}
|
215 |
+
|
216 |
+
# get output image in same resolution as input
|
217 |
+
payload = {
|
218 |
+
"size": "full"
|
219 |
+
}
|
220 |
headers = {
|
221 |
"accept": "image/*",
|
222 |
'X-Api-Key': REMOVE_BG_KEY
|
223 |
}
|
224 |
+
remove_bg_request = requests.post(url, files=files, data=payload, headers=headers, timeout=20)
|
225 |
if remove_bg_request.status_code == 200:
|
226 |
image_content = remove_bg_request.content
|
227 |
pil_image = ImageFormatConvertor.binary_data_to_pil_image(image_content)
|