Virtual Try-On for Indian Ethnic Wear with Nano Banana Pro
Create immersive virtual try-ons for Indian ethnic wear using high-fidelity imaging.
~$0.2164
1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/698adea30d71a19b562cb210-v1"
7
8data = {
9 "image_75wwc": "https://segmind-inference-inputs.s3.amazonaws.com/6aeb8269-2467-45e9-9297-af19d4d43b45-pexels-glassesshop-gs-1317359316-27603695.jpg",
10 "image_qrdxvi": [
11 "https://segmind-inference-inputs.s3.amazonaws.com/d3bcbc68-59fb-4ba2-999f-8c451ba0d2a5-pexels-aalap-creation-2158557916-35508909 copy 2.jpg",
12 "https://segmind-inference-inputs.s3.amazonaws.com/46e7375f-9880-4024-bff1-09ce3e6bb773-pexels-aalap-creation-2158557916-35508909 copy.jpg"
13 ],
14 "image_o18qe": "https://segmind-inference-inputs.s3.amazonaws.com/e4603dcd-2f79-48df-8f37-92613b32924a-imagine (1).png"
15}
16
17def poll_for_result(poll_url):
18 """Poll the API until the generation is complete"""
19 while True:
20 response = requests.get(
21 poll_url,
22 headers={'Authorization': f'Bearer {api_key}'}
23 )
24 result = response.json()
25
26 if result['status'] == 'COMPLETED':
27 # Parse the output (it's a JSON string)
28 outputs = json.loads(result['output'])
29 return outputs
30 elif result['status'] == 'FAILED':
31 raise Exception(result.get('error', 'Generation failed'))
32
33 # Wait 7 seconds before polling again
34 time.sleep(7)
35
36# Make the initial request
37response = requests.post(
38 url,
39 json=data,
40 headers={
41 'Authorization': f'Bearer {api_key}',
42 'Content-Type': 'application/json'
43 }
44)
45
46if response.status_code == 200:
47 result = response.json()
48 print('Request queued:', result)
49
50 # Start polling for results
51 outputs = poll_for_result(result['poll_url'])
52 print('Generation complete:', outputs)
53else:
54 print(f"Error: {response.status_code}")
55 print(response.text) 1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/698adea30d71a19b562cb210-v1"
7
8data = {
9 "image_75wwc": "https://segmind-inference-inputs.s3.amazonaws.com/6aeb8269-2467-45e9-9297-af19d4d43b45-pexels-glassesshop-gs-1317359316-27603695.jpg",
10 "image_qrdxvi": [
11 "https://segmind-inference-inputs.s3.amazonaws.com/d3bcbc68-59fb-4ba2-999f-8c451ba0d2a5-pexels-aalap-creation-2158557916-35508909 copy 2.jpg",
12 "https://segmind-inference-inputs.s3.amazonaws.com/46e7375f-9880-4024-bff1-09ce3e6bb773-pexels-aalap-creation-2158557916-35508909 copy.jpg"
13 ],
14 "image_o18qe": "https://segmind-inference-inputs.s3.amazonaws.com/e4603dcd-2f79-48df-8f37-92613b32924a-imagine (1).png"
15}
16
17def poll_for_result(poll_url):
18 """Poll the API until the generation is complete"""
19 while True:
20 response = requests.get(
21 poll_url,
22 headers={'Authorization': f'Bearer {api_key}'}
23 )
24 result = response.json()
25
26 if result['status'] == 'COMPLETED':
27 # Parse the output (it's a JSON string)
28 outputs = json.loads(result['output'])
29 return outputs
30 elif result['status'] == 'FAILED':
31 raise Exception(result.get('error', 'Generation failed'))
32
33 # Wait 7 seconds before polling again
34 time.sleep(7)
35
36# Make the initial request
37response = requests.post(
38 url,
39 json=data,
40 headers={
41 'Authorization': f'Bearer {api_key}',
42 'Content-Type': 'application/json'
43 }
44)
45
46if response.status_code == 200:
47 result = response.json()
48 print('Request queued:', result)
49
50 # Start polling for results
51 outputs = poll_for_result(result['poll_url'])
52 print('Generation complete:', outputs)
53else:
54 print(f"Error: {response.status_code}")
55 print(response.text)API Endpoint
POST
https://api.segmind.com/workflows/698adea30d71a19b562cb210-v1Parameters
image_75wwcoptionalstring (uri)Image 75wwc
Default:
"https://segmind-inference-inputs.s3.amazonaws.com/6aeb8269-2467-45e9-9297-af19d4d43b45-pexels-glassesshop-gs-1317359316-27603695.jpg"image_qrdxvioptionalarrayImage Qrdxvi
Default:
["https://segmind-inference-inputs.s3.amazonaws.com/d3bcbc68-59fb-4ba2-999f-8c451ba0d2a5-pexels-aalap-creation-2158557916-35508909 copy 2.jpg","https://segmind-inference-inputs.s3.amazonaws.com/46e7375f-9880-4024-bff1-09ce3e6bb773-pexels-aalap-creation-2158557916-35508909 copy.jpg"]image_o18qeoptionalstring (uri)Image O18qe
Default:
"https://segmind-inference-inputs.s3.amazonaws.com/e4603dcd-2f79-48df-8f37-92613b32924a-imagine (1).png"Response Format
Returns: Polling-based asynchronous response
Initial request returns a poll_url. Poll every 7 seconds until status is COMPLETED.
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
400
Bad Request
Invalid parameters or request format
401
Unauthorized
Missing or invalid API key
403
Forbidden
Insufficient permissions
404
Not Found
Workflow not found
406
Insufficient Credits
Not enough credits to process request
429
Rate Limited
Too many requests
500
Server Error
Internal server error
502
Bad Gateway
Service temporarily unavailable
504
Timeout
Request timed out