A web application that allows users to upload images and receive AI-generated captions using Microsoft Azure AI Vision. The project features a Vue 3 + Vite frontend and a Flask backend, designed for easy deployment on Azure.
This application allows users to upload images via a web frontend. The backend sends the image to Microsoft Azure AI Vision / Computer Vision and returns an image caption, which is displayed in the frontend.
image-caption/
backend/
app/
routes/
services/
.venv/
frontend/
src/
components/
services/
public/
docs/
infra/
modules/
scripts/
- Change to the
backenddirectory:cd backend - Create a local virtual environment:
python -m venv .venv
- Activate the environment:
source .venv/bin/activate - Install the dependencies:
pip install -r requirements.txt
- Create a
.envfile (see.env.example). - Start the backend (development):
For production (e.g., Azure App Service):
flask --app run run
gunicorn run:app
- Change to the
frontenddirectory:cd frontend - Install the dependencies:
npm install
- Start the development server:
npm run dev
- Create a
.envfile in the backend (see.env.example). - Required variables:
AZURE_VISION_ENDPOINTAZURE_VISION_KEYMAX_CONTENT_LENGTH(optional, e.g., 4 * 1024 * 1024 for 4MB)
- Azure CLI installed and logged in (
az login) - SWA CLI installed for frontend deployment (
npm install -g @azure/static-web-apps-cli) - For backend: Azure App Service and resource group created (see infra/)
- For frontend: Azure Static Web App resource created (see infra/)
- Required environment variables set (see below)
To deploy the backend to Azure App Service:
- Ensure you are logged in to Azure:
az login az account set --subscription "<SUBSCRIPTION_ID_OR_NAME>"
- Set the required environment variables in your shell:
export AZURE_VISION_ENDPOINT="https://<your-endpoint>.cognitiveservices.azure.com/" export AZURE_VISION_KEY="<your-key>"
- Run the backend deployment script from the project root:
The script will package the backend, set app settings, and deploy to Azure App Service. The deployed API endpoint will be shown at the end.
./scripts/deploy_backend.sh
To deploy the frontend to Azure Static Web Apps:
- Ensure you are logged in to Azure:
az login az account set --subscription "<SUBSCRIPTION_ID_OR_NAME>"
- (Optional) Set the SWA deployment token if not using Azure CLI authentication:
export SWA_CLI_DEPLOYMENT_TOKEN="<your-static-web-app-deployment-token>"
- Run the frontend deployment script from the project root:
The script will build the frontend and deploy it to Azure Static Web Apps. The production URL will be shown at the end.
./scripts/deploy_frontend.sh
- The scripts perform pre-checks and will fail early if requirements are not met.
- For custom resource names or locations, adjust the variables at the top of each script.
- Ensure your backend and frontend are correctly linked in Azure for production API calls.
- For infrastructure provisioning, see the
infra/directory and its documentation.
- Flask Documentation
- Vue.js 3 Documentation
- Vite Documentation
- Bulma CSS Framework
- Azure AI Vision Documentation
- Azure CLI Documentation
- Bicep Documentation
- Azure App Service Documentation
- Azure Static Web Apps Documentation
- Azure Key Vault Documentation
Author:
Copyright (c) 2026 Roland Abel (GitHub)
AI Assistance:
Parts of this project were created or improved with the help of AI-based tools, including GitHub Copilot and other
generative AI assistants.
This software is available under the following licenses: