Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDelphiRAD Studio

Upscale Images With DeepAI’s Super Resolution API

Super Resolution API

DeepAI is a prominently popular platform for artificial intelligence. They provide research, guides, news, and several AI APIs.

You can learn more about their APIs from this link: https://deepai.org/apis

The range and depth of the APIs offered by DeepAI are quite astounding. They include APIs which allow for image colorization, facial recognition, nudity detection, sentiment, and emotion detection, text summarization, pose detection, text/caption generation, OCR, text to image, signature verification, toonify (to turn images into cartoon-like drawings), content moderation, anonymization and MANY more – the complete list is pretty staggering! Chances are DeepAI has something to satisfy your needs for adding and using artificial intelligence to integrate it with IDE Software for Windows, desktop, and mobile apps.

We’re going to focus on one API in particular – the Super Resolution API.

What is Super Resolution API?

In this article, we are going to implement the “Super Resolution API” using Delphi. This API uses machine learning to clean, sharp and upscale photos with out losing the original content. It can correct blurry images to some accepted level. This is not a simple mathematical algorithm to upscale image, but a machine learning which identify the content and make it better without losing original content. So it’s always better than an image processing application in your PC.

How to get DeepAI API key?

It’s easy to get the API key. You don’t need an Credit card. You will get $5 USD API credits free at registration which equivalent to 10,000 API requests. After that you can pay by $0.50 USD per 1000 requests. You can signup with google account or a regular signup. Then go to Dashboard and you can find the API key. You can use that key for any API.

How to send a request to Super Resolution API from Delphi?

There are two types of requests depending on,

  1. Send image as URL
  2. Send image as file

Parameters are the same for both requests.

  • api-key: API key as header parameter
  • image: Image to process

Code to send the API request using REST components are like this:

You can send images in most of image file types, but the response always will be a JPG file.

How to process the response from the Super Resolution API?

If the request is success, you will get a response in JSON like this:

ID is the unique id of your processed resource. “output_url” is the URL of your processed image. We can parse this JSON in Delphi like this and get the image as TPicture:

It can take a while to process the image and send the response. So it’s recommended to use a thread to prevent from blocking the GUI.

You can download this demo application to see how it works. Just grab the API key form DeepAI, upload an image and start processing.

Super Resolution API

You can download the example code here: https://github.com/checkdigits/SuperResolutionAPI_example

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES