Skip to content

[Syed.Atyab@Codeline.rihal.om] One-Click Secure Image Caption Demo #16

Description

@CodelineAtyab

Omantel Hackathon – Secure Image Captioning Demo

Goal:
Enable participants to log in with their corporate Outlook account, upload a single image, and instantly receive an AI-generated caption—demonstrating the complete secure stack:

Azure OAuth2 ➜ FastAPI ➜ n8n ➜ HuggingFace


User Story

As a… I want… So that…
Omantel hackathon participant to log in with my corporate Outlook account and upload one image to receive an AI-generated caption I can validate the end-to-end secure stack in a single, easy demo

Acceptance Criteria

  1. SSO & Authentication
    • Unauthenticated visits to / are redirected to Microsoft Azure SSO.
    • After successful login, a valid JWT is stored in the FastAPI session.
    • FastAPI verifies the JWT signature using Azure’s public key.
    • No password fields are ever displayed in the UI.

  2. Main Page UI
    • Displays a simple form:

    • Image-file selector (max 5 MB)
    • “Generate Caption” button
  3. Image Upload & Storage
    • On button press, the image is uploaded to MinIO/S3.
    • File URL + user email are inserted into Postgres.

  4. Caption Generation Workflow
    • FastAPI triggers the Image-to-Caption n8n workflow via internal API (secret API-key header).
    • n8n calls a HuggingFace model to generate a text caption.
    • Caption is saved back to the same Postgres row.
    • Caption is immediately returned to the frontend and displayed beneath the uploaded image.

  5. Performance
    • Full round-trip (upload → caption → display) completes in ≤ 10 seconds for images ≤ 5 MB on a developer laptop via docker-compose.

  6. Persistence & History
    • Refreshing the page lists the user’s last 3 captioned images, retrieved from Postgres.

  7. Observability
    Prometheus metrics exposed by FastAPI at /metrics:

    • image_upload_total
    • caption_latency_seconds
      • Metrics are viewable in a pre-configured Grafana dashboard.
  8. Local Development
    • All services (FastAPI, n8n, Postgres, MinIO) run locally via the provided docker-compose.yml.
    • A single command starts everything:

    docker compose up

Tech Stack Overview

Layer Technology Purpose
Authentication Azure OAuth2 Corporate SSO & JWT issuance
API / Backend FastAPI Session handling, API gateway, metrics
Workflow Orchestration n8n Image-to-Caption pipeline
AI Model HuggingFace Caption generation
Object Storage MinIO/S3 Image storage
Database Postgres Metadata & captions
Monitoring Prometheus + Grafana Metrics & dashboards
Containerisation Docker Compose One-command local setup

Quick Start

# Clone repository
git clone <repo-url> && cd <repo-dir>

# Launch the entire stack
docker compose up

Open your browser at http://localhost:8000, sign in with your Outlook account, and start captioning!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions