Model details
Example usage
1import json
2import requests
3
4def main():
5 api_key = "YOUR_API_KEY"
6 model_id = "MODEL_ID"
7
8 payload = {
9 "subject_image": "<base64_image_string_here>",
10 "prompt": "Make the cubes pink",
11 "remove_bg": False,
12 "matting": False,
13 "steps": 8,
14 "strength_sub": 1.0,
15 "strength_spat": 1.0,
16 "size": 1024,
17 "rank": 3.0,
18 "bg_detail_cutoff": 3,
19 "blend_mode": "Detail-preserving",
20 }
21
22
23 resp = requests.post(
24 f"https://model-{model_id}.api.baseten.co/environments/production/predict",
25 headers={"Authorization": f"Api-Key {api_key}"},
26 json=payload
27 )
28 resp.raise_for_status()
29
30 response_dict = json.loads(resp.text)
31
32 for i in response_dict:
33 print("key: ", i, "val: ", response_dict[i])
34
35 with open('b64.txt', 'w') as f:
36 f.write(response_dict["blended"])
37
38if __name__ == "__main__":
39 main()
Input
JSON output
1null
Preview
