Youzu Fill
The Youzu Fill component allows users to fill a room with furniture items.
API
The Fill API allows you to remove objects from room images by providing the room image and the product images to remove.
Authentication
Use the Authorization: Bearer YOUR_TOKEN header with a single-use token obtained from /api/v1/token. Generate a fill:create token for creation and a new fill:read token for every status request.
Create Fill Job
Endpoint: POST /api/v1/fill
Remove objects from room images by providing the room image and product images to remove.
curl -X POST "https://platform.youzu.ai/api/v1/fill" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "roomImage=@room.jpg" \
-F "productImages=@product1.png" \
-F "productImages=@product2.png" \
-F "prompt=Remove furniture from room"
// Remove objects from room images using token
const roomImage = document.getElementById('room-input').files[0];
const productImage1 = document.getElementById('product1-input').files[0];
const productImage2 = document.getElementById('product2-input').files[0];
const formData = new FormData();
formData.append('roomImage', roomImage);
formData.append('productImages', productImage1);
formData.append('productImages', productImage2);
formData.append('prompt', 'Remove furniture from room');
fetch('https://platform.youzu.ai/api/v1/fill', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
},
body: formData
})
.then(response => response.json())
.then(data => {
console.log('Fill job created:', data);
// Poll for completion using data.id
})
.catch(error => {
console.error('Error:', error);
});
import requests
# Remove objects from room images using token
url = 'https://platform.youzu.ai/api/v1/fill'
headers = {
'Authorization': 'Bearer YOUR_TOKEN'
}
files = [
('roomImage', open('room.jpg', 'rb')),
('productImages', open('product1.png', 'rb')),
('productImages', open('product2.png', 'rb'))
]
data = {
'prompt': 'Remove furniture from room'
}
response = requests.post(url, headers=headers, files=files, data=data)
if response.status_code == 200:
job = response.json()
print('Fill job created:', job)
# Poll for completion using job['id']
else:
print('Error:', response.status_code, response.text)
Get Fill Status
Endpoint: GET /api/v1/fill/{id}
Check the status of a fill job.
curl -X GET "https://platform.youzu.ai/api/v1/fill/YOUR_JOB_ID" \
-H "Authorization: Bearer YOUR_TOKEN"
// Check fill status using token
fetch('https://platform.youzu.ai/api/v1/fill/YOUR_JOB_ID', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => response.json())
.then(data => {
console.log('Job status:', data.status);
if (data.status === 'COMPLETED') {
console.log('Result URL:', data.outputUrls[0]);
}
})
.catch(error => {
console.error('Error:', error);
});
import requests
# Check fill status using token
url = 'https://platform.youzu.ai/api/v1/fill/YOUR_JOB_ID'
headers = {
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
job = response.json()
print('Job status:', job['status'])
if job['status'] == 'COMPLETED':
print('Result URL:', job['outputUrls'][0])
else:
print('Error:', response.status_code, response.text)
SDK
Props
| Property | Attribute | Type | Default |
|---|---|---|---|
currency |
currency |
string | undefined |
lang |
lang |
string | undefined |
Events
| Event | Description | Type |
|---|---|---|
productAddedToBasket |
CustomEvent<FurnitureProduct> |
|
productClicked |
CustomEvent<FurnitureProduct> |