AI Images Processing API
AI Quality Enhancement, AI Upscale, AI Uncrop, AI Restoration, etc.
First, make sure you've read Getting Started guide and you have your API token ready.
Photos upload
Please read "Files Upload" section of this documentation.
For each file we are going to upload, we need to generate special unique presigned URL.
To do that you need to request /upload
endpoint and pass file extension and mime-type. We hope these parameters will not be new to you.
Let's do this with curl:
curl --request POST \
--url https://api.neural.love/v1/upload \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"extension": "jpg",
"contentType": "image/jpeg"
}'
You will receive two parameters in response. First we will need url
to upload the file, and s3Url
to make a training request.
Let's upload our files. For each of them just use url
to upload:
curl --request PUT \
--url '<url>' \
--upload-file '/path/to/file/on/your/computer.jpg'
Save s3Url
of each file to start processing later.
Processing
After you upload all files you can start processing:
curl --request POST \
--url https://api.neural.love/v1/images/process \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"files": [
"s3://prod-incoming-saas-neural-love/f1bb412a20db/1ed71c42-2322-62dc-b332-3b2bd6c1f04e.jpg",
"s3://prod-incoming-saas-neural-love/f1bb412a20db/1ed71c9d-c002-63f8-b12a-83521ccdb63c.jpg",
"etc"
],
"parameters": {
"uncrop": {
"mode": "outpainting"
},
"image_sharpen": {
"aggressive": true
}
}
}'
After successful request (you'll get orderId
to use later) please wait 1-2 minutes until the result will be ready.
Possible parameters
Inside parameters
you can specify which AI transformations you want to apply to each image. Here are some examples:
# Quality enhance (Upscale)
"quality_enhance": {
"multiplier": "4x",
"noise": true
}
# Image sharpen & unblur
"image_sharpen": {
"aggressive": true
}
# Colorization (no settings available)
"image_colorization": {}
# Facial Restoration (no settings available)
"image_facial_restoration": {}
# Old photo restoration
"old_photo_restoration": {
"remove_scratches": true,
"fix_colors": false
}
AI Uncrop is a separate process and cannot be combined with other parameters:
# Uncrop - outpainting
"image_uncrop": {
"mode": "outpainting",
"iterations": 1 // or 2
}
# Uncrop - Change aspect ratio
"image_uncrop": {
"mode": "aspect_ratio",
"aspect_ratio": "16:9"
}
Getting results
After some time (usually 1 minute) you can start checking the order status. We recommend doing that in increasing intervals, e.g. after 30, 45, 60, 90, 150 seconds etc.
Use order's id
to get information about it. You can use status.isReady
field to check if the processing is over.
curl --request GET \
--url https://api.neural.love/v1/images/orders/1ed271bf-79d5-6dc2-b2a4-27367288a342 \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
After the processing is over you'll have all results in files
section. Detailed documentation is available here.
Updated 12 months ago