1
https://api2.aitwo.co/generate/ai-exterior/
{
"code": 100,
"data": {
"image_url": "url of generated image ",
"id": "generated image id"
},
"message": "success"
}
{
"code": "Any code other than 100",
"message": "error_message"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import requests
url = 'https://api2.aitwo.co/generate/ai-exterior/'
# Example data
headers = {
"Auth": "Bearer YOUR_API_KEY"
}
data = {
"buildingType": "house",
"buildingStyle": "rustic",
"materials": "wood, stone, metal"
}
files = {'image': open('path/to/image.jpg', 'rb')}
response = requests.post(url, headers=headers, json=data, files=files)
print(response.json())
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const axios = require('axios');
const url = 'https://api2.aitwo.co/generate/ai-exterior/';
// Example data
const data = {
"buildingType": "house",
"buildingStyle": "rustic",
"materials": "wood, stone, metal"
};
const formData = new FormData();
formData.append('image', fs.createReadStream('path/to/image.jpg'));
Object.entries(data).forEach(([key, value]) => {
formData.append(key, value);
});
axios.post(url, formData, { headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});