Back to Blog

Building a highly scalable API for AI image enhancement

Jamie McInally

Building a highly scalable API for AI image enhancement

When we started our photo editing service - Autoenhance.ai - we considered that our web app was the best way for users to enhance their images and receive an instant AI enhancement. Our users interact with multiple services and websites every day. We didn’t want to add to their list; instead, we tried to integrate Autoenhance.ai into existing services utilised by our users. We had many conversations with potential clients in those early stages, and “Do you have an API?” was the question many people asked. We then had to ask ourselves: “Why don't we have an API?”

We’d built a successful internal API, but it wasn’t a RESTful API by definition. Initially, we gave our users access to this API, but there were many flaws, such as security, and the layout of the API was not intuitive. It required a 30-minute walk-through to understand it.

In March, James Campbell joined Autoenhance.ai as CTO. First, I gave him a walkthrough of our API and straight away, he called me out, saying that the API isn’t simple. He immediately called the team and said, “ We’re going to engineer a new Autoenhance.ai API”.

We started with security. AWS is our cloud provider, which has an excellent platform called API gateway to provision API keys for clients and maps pricing plans. This visibility allows us to lock the whole system down and monitor individual users to ensure we provide the right AI resources.

Secondly, we focussed on scalability. We used Sagemaker (a platform as a service) for our AI endpoints, but running on GPUs didn’t give us the scalability we needed to make our AI reactionary to API usage. We required smaller CPU instances that could be provisioned at peak usage (afternoons) and scaled-down during low use (at night). Additionally, we wanted to move away from ECS (elastic container service) to something even more scalable - serverless. However, some drawbacks include uploading images to serverless, limited to the maximum storage size of 6MB payload. We overcame this by providing users with a signed S3 endpoint for uploading pictures.

With our new architecture in place, we’ve started to make our endpoints more intuitive. Previously our endpoints were POST /upload, POST /status and POST /getimage, which relates to the user’s actions. However, this is not RESTful. Our new API uses the CRUD format e.g. POST /image to upload the image, GET /image/{imageid} to get the image status, GET /image/{image_id}/enhanced, to view the enhanced image.

Since releasing the new architecture, we’ve provided a consistent average turnaround time of 10 seconds per image and scaled efficiently with zero downtime. We’ve received positive customer feedback, and our visibility across the system assists us in improving the API continually.

The new API was a "great success"

Sign up for our API and follow the steps for integration.

Try our photo editing service to receive the instant enhancement.


Share on social media: 

More from the Blog

How we enhanced 3 Christmas movie houses with automated photo editing software

When I’ve searched online for images of Christmas movie houses, I found that some of the property images seem too dark. So, I uploaded them to Autoenhance.ai.

Read Story

How property photography businesses can benefit from AI

When it comes to editing photos, property photographers are implementing AI into their processes to speed up their workflows, cut costs and free up their time to get more business.

Read Story

A trip to Vienna: Adding a sky replacement to holiday images

Autoenhance.ai recently updated our sky replacement feature. In my blog post, I take you through replacing the sky in my architectural images from my trip to Vienna. 

Read Story

Never miss a minute.

Subscribe now to get our latest blog posts.
We will never share your email address with third parties.