Upscale Images Via Machine Learning With Javascript Super Resolution API
Images are everywhere. Whether on the internet, our phones, or even in our day-to-day lives, most people amass huge volumes of data in the form of digital images of varying quality. Any library of digital images, personal or public, is likely to contain low-quality or blurry images. Unfortunately, however, these can problematic to view or, or worse, to analyze. In particularly bad cases, you need to zoom to better see or analyze parts of an image, but even then the image may lack the detail or resolution to do this effectively. For this reason, having an automated and intelligent tool that can upscale and create high-quality, high-resolution images is remarkably useful. Enter DeepAI’s Super Resolution API. It uses machine learning (ML) and AI techniques to upscale images into higher resolutions without compromising their quality or losing their content. DeepAI’s Super Resolution AI can generate an upscaled version of an image within seconds. If this sounds useful, let’s take a look at how you can quickly build a Sencha Ext JS app that upscales any image you input by calling the DeepAI Super Resolution API. Once we are done, your final app will look like this: What is the DeepAI Super Resolution API? To understand the DeepAI Super Resolution API, once you have your prerequisites installed type the following at the command prompt: curl -F ‘image=https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Tulipa_orphanidea_060506.jpg/260px-Tulipa_orphanidea_060506.jpg’ -H ‘api-key:quickstart-QUdJIGlzIGNvbWluZy4uLi4K’ https://api.deepai.org/api/torch-srgan This command accepts the URL of an input image and submits an API key to generate a new version of the image with a higher resolution and better quality. If you get it right, the response from the API looks like this: { “id”: “025c64f7-a610-4ee5-aa33-b215d703c595”, “output_url”: “https://api.deepai.org/job-view-file/025c64f7-a610-4ee5-aa33-b215d703c595/outputs/output.jpg”} As you can see, it returns a response that is a JSON object with the URL of the upscaled image. Better yet, not only is the input image enlarged 4 times, it has also has improved in quality. One thing you need to be aware of though, is that with DeepAI APIs, you only get a quick start API key with a set number of queries. Once your trial expires, you have to get your own API key. How can I upscaling images using AI in Javascript? If you think this is useful, here are 4 easy steps that you can follow to build your own application in a matter of minutes. Step 1: Create an Ext JS Minimal Desktop Application To develop an app to upscale any image you input, first create a blank minimal desktop application in EXT JS. If you are new to Sencha’s Ext JS framework, you can follow this tutorial to create a minimal desktop application from the command prompt. I have chosen to create all my files in a folder called super-res and I call the app superRes. Step 2: Include the DeepAI Package To include the DeepAI package, open the index.html file located in the main directory and add the following line anywhere in the header of the HTML: Step 3: Create the Main View In the main view, we have the following: A text field for the URL of the input image An area to display the input image A button labelled ‘Upscale Image’ A text field to display the URL of the output upscaled image An area to display the output image To get started, […]
