/azsdkdemo

Let's demo the new Azure SDKs

Primary LanguageC#MIT LicenseMIT

Azure SDK Demo - Azure Image Analyzer

The repo demonstrates Azure SDK usage via a complete application. This application takes in an image, uploads it to Blog Storage and enqueues a message into a Queue. A process receives that message and uses Form Recognizer to extract the text from the image, then uses Text Analytics to get the sentiment of the text, and then stores the results in a Cosmos DB.

Pre-reqs

The following are required to run this application.

  1. A Terminal - We tested this with Git Bash and WSL - it will not currently work with PowerShell or Windows Command Prompt. The Terraform deployment currently only works on Linux compatible systems. You will need to run all the commands below in your selected terminal.
  2. Install Azure CLI
  3. Install Terraform
  4. Install Git
  5. Install VS Code
  6. Install Docker
  7. An Azure Subscription

Azure Resources

The following Azure resources will be deployed with the Terraform script.

  1. Resource Group
  2. Storage Account
  3. Cognitive Services Form Recognizer
  4. Cognitive Services Text Analytics
  5. Cosmos DB
  6. App Service: Plan
  7. App Service: Web Apps
  8. App Service: API Apps
  9. Application Insights

Code Setup

  1. Open Git Bash or WSL - The same terminal you used to install the pre-reqs above.

    NOTE: Known issue: The following terraform deployment doesn't work in WSL2. We are investigating that issue for now use Git Bash.

  2. Clone Repo git clone https://github.com/jongio/azsdkdemo
  3. Azure CLI Login az login
  4. Create Azure Resources with Terraform
    1. CD to iac/terraform
    2. Terraform init: terraform init
    3. Terraform plan: terraform plan -var="basename=azsdkdemo1" --out tf.plan

      Change the basename variable from azsdkdemo1 to something that will be globally unique. It will be used as part of Azure resource names, so keep it short, lowercase, and no special characters.

    4. Terraform apply: terraform apply tf.plan
  5. Update .env file
    1. Rename .env.tmp to .env
    2. Copy and paste the terraform output values to the .env file.

      NOTE: .env files do not allow spaces around the =, so please remove any spaces after you copy and paste.

Run Application

  1. CD to src folder for the language you would like to run, i.e. for .NET, cd to src/net for Python, cd to src/python
  2. Run docker-compose up --build
  3. Navigate to http://localhost:1080
  4. Add an Image
    1. Enter url into text box and click "Submit"
    2. Or click "Add Random Meme"
    3. The image will be added to the grid. Wait for the service to pick it up. You will eventually see the text and the image border color will change indicating the image text sentiment.