Python 3 Script to Remove Background From Image Using Slazzer API Full Project For Beginners

 

 

app.py

 

 

import requests

URL = "https://api.slazzer.com/v2.0/remove_image_background"
PATH = "YOUR_IMAGE_PATH"
API_KEY = "YOUR_SLAZZER_API_KEY"

image_file = {'source_image_file': open(PATH, 'rb')}
headers = {'API-KEY': API_KEY}
response = requests.post(URL, files=image_file, headers=headers)
with open('output.png', 'wb') as img:
    img.write(response.content)

Leave a Reply