Analyze Images with Cognitive Services

Let’s explore the uses of Microsoft Computer Vision with the help of a Django application.

We'll cover the following

Introduction

In this lesson, we’ll use a sample application to test Microsoft Computer Vision’s APIs. First, we made a new project on Django by the name mscv. Then we made an application by the name apis in the project. The application has the following three models:

  • Key_Endpoint to store the key and endpoint to make the API call.
  • OCR to extract texts from images and PDFs
  • ImageAnalysis2 to perform all the operations explained in the Image Analysis section.

Workflow

The application has the following functionalities:

  • "Home" tab: It describes the functionalities of the application.
  • "OCR" tab: In this tab, we simply have to paste the URL of the image in the “Image URL” field and press the “Run” button to get our results.
  • "Analysis" tab: In this tab, we have to paste the URL of the image in the “Image URL” field and select all the functionalities we want to perform on the image. Then we’ll press the “Run” button to get our results.

Press the “Run” button below to see how it works.

"""
ASGI config for mscv project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mscv.settings')

application = get_asgi_application()
Image analysis application