← Back to list

🚀 Building a Sentiment Analysis App with Azure DevOps CI/CD, ACR, and ACI

🌟 Introduction

Dinesh · 2026-06-05 17:52 · 0 claps · 1.9 min read
#python-flask #sentiment-analysis #azure-container-instances #docker #azure-devops
Open on Medium ↗
Wiki topics: 🌐 · Web Development ☁️ · DevOps & Cloud

🚀 Building a Sentiment Analysis App with Azure DevOps CI/CD, ACR, and ACI

🌟 Introduction

In today’s world, showcasing AI applications to clients often requires more than just code — you need a working demo, a clean UI, and a professional deployment pipeline. In this article, I’ll walk you through building a sentiment analysis web app with Python Flask, containerizing it with Docker, and deploying it to the cloud using Azure DevOps CI/CD, Azure Container Registry (ACR), and Azure Container Instance (ACI).

🧠 The AI Concept

The app demonstrates Sentiment Analysis — a Natural Language Processing (NLP) technique that evaluates text to determine:

  • Polarity → whether the text is positive, negative, or neutral.
  • Subjectivity → whether the text is factual or opinionated.

We use the TextBlob library to keep things simple and lightweight.

📂 Project Structure

Code. ├── app.py # Flask application ├── requirements.txt # Python dependencies ├── Dockerfile # Container build instructions ├── templates/ │ └── index.html # Front-end UI └── azure-pipelines.yaml # CI/CD pipeline definition

app.py

from flask import Flask, request, render_template from textblob import TextBlob

app = Flask(name)

@app.route(“/”) def home(): return render_template(“index.html”)

@app.route(“/sentiment”, methods=[“POST”]) def sentiment(): text = request.form.get(“text”, “”) analysis = TextBlob(text) result = { “polarity”: analysis.sentiment.polarity, “subjectivity”: analysis.sentiment.subjectivity } return render_template(“index.html”, text=text, result=result)

if name == “main”: app.run(host=”0.0.0.0", port=5000)

templates/index.html

<!DOCTYPE html> <html> <head> <title>Sentiment Analyzer</title> </head> <body> <h1>Sentiment Analyzer</h1> <form method=”POST” action=”/sentiment”> <input type=”text” name=”text” placeholder=”Enter text here” required /> <button type=”submit”>Analyze</button> </form>

{% if result %} <h2>Result for: “{{ text }}”</h2> <p>Polarity: {{ result.polarity }}</p> <p>Subjectivity: {{ result.subjectivity }}</p> {% endif %} </body> </html>

Dockerfile FROM python:3.9-slim WORKDIR /app COPY requirements.txt . RUN pip install — no-cache-dir -r requirements.txt COPY . . EXPOSE 5000 CMD [“python”, “app.py”]

requirements.txt

flask textblob

azure-pipelines.yml

trigger:

  • main

pool: vmImage: ‘ubuntu-latest’

variables: imageName: ‘sentiment-ui-app’

steps:

  • task: Docker@2 inputs: containerRegistry: ‘your-acr-service-connection’ repository: ‘$(imageName)’ command: ‘buildAndPush’ Dockerfile: ‘**/Dockerfile’ tags: | $(Build.BuildId)
  • task: AzureCLI@2 inputs: azureSubscription: ‘your-azure-subscription’ scriptType: ‘bash’ scriptLocation: ‘inlineScript’ inlineScript: | az container update \ — resource-group your-resource-group \ — name your-existing-aci-name \ — image youracr.azurecr.io/$(imageName):$(Build.BuildId) az container restart \ — resource-group your-resource-group \ — name your-existing-aci-name

🌐 Demo Flow

  1. Push code → Pipeline runs automatically.
  2. Image stored in ACR.
  3. Existing ACI updated with new image.
  4. Client opens the app in browser.
  5. Types text → Sees instant sentiment analysis results.

📝 Conclusion

This project demonstrates a complete AI + DevOps workflow:

  • AI concept: Sentiment Analysis.
  • Backend: Python Flask.
  • Frontend: HTML UI.
  • Containerization: Docker.
  • Deployment: Azure ACR + ACI.
  • Automation: Azure DevOps CI/CD

메타데이터
post_id
980eb8cf70be
slug
building-a-sentiment-analysis-app-with-azure-devops-ci-cd-acr-and-aci-980eb8cf70be
url
https://medium.com/@dineshOffl/building-a-sentiment-analysis-app-with-azure-devops-ci-cd-acr-and-aci-980eb8cf70be
canonical_url
https://medium.com/@dineshOffl/building-a-sentiment-analysis-app-with-azure-devops-ci-cd-acr-and-aci-980eb8cf70be
author_url
https://medium.com/@dineshOffl
status
ok
fetched_at
2026-06-23 21:39:52