Portraits HD Guide

Restore your old portraits to a quality never seen before

First, make sure you've read Getting Started guide and you have your API token ready.

Photo upload

Please read "Files Upload" section of this documentation.

For a 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 generation 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'

Generate portrait

After you upload a file you can start generation of the portrait using s3Url you received earlier:

curl --request POST \
     --url https://api.neural.love/v1/portraits/generate \
     --header 'Authorization: Bearer <TOKEN>' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --data '{"s3Url": "s3://prod-incoming-saas-neural-love/f1bb412a20db/1ed71c42-2322-62dc-b332-3b2bd6c1f04e.jpg"}'

After successful request (you'll get orderId to use later) please wait 1-3 minutes until the result will be ready. If you have a lot of portraits to process you can request more resources to accommodate your load.

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, 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/portraits/orders/1ed271bf-79d5-6dc2-b2a4-27367288a342 \
     --header 'Authorization: Bearer <TOKEN>' \
     --header 'Accept: application/json'

After the processing is over you'll have resulting portrait in portrait field. Detailed documentation is available here.

Cost estimation

Generation of single portrait cost 3 credits (≈ 30¢).