# jagadeesh-boyalla-03/ai-powered-social-caption-generator architecture

> Architecture diagram of the GitHub repository jagadeesh-boyalla-03/ai-powered-social-caption-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator
- Repository: https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator

## Overview

This repository provides image- and video-to-caption tools, centered on a FastAPI web application that accepts media and caption preferences, analyzes the media, and returns platform-specific captions. It also includes CLI and Streamlit captioning clients, earlier BLIP-based image-captioning examples, and a separate CLIP/FAISS text-to-image search workflow. Edges reflect calls and data flows visible in excerpts or README statements; the browser-to-API link is dashed because the frontend source was not sampled.

Main entry points: [`api/index.py`](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py) (Caption API), [`index.html`](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/index.html) (Web UI), [`6_social_media_captions.py`](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/6_social_media_captions.py) (Caption CLI), [`7_streamlit_social_demo.py`](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/7_streamlit_social_demo.py) (Social demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web captioning"]
  node_web_ui["Web UI<br/>[index.html]"]
  node_api["Caption API<br/>[index.py]"]
  node_media_analysis["Media analysis<br/>[index.py]"]
  node_caption_generation["Caption generation<br/>[index.py]"]
  node_caption_rules["Platform rules<br/>[index.py]"]
end

subgraph group_clients["Captioning clients"]
  node_cli["Caption CLI"]
  node_social_demo["Social demo"]
end

subgraph group_search["Image search"]
  node_index_builder["Build image index"]
  node_image_index[("FAISS image index")]
  node_image_search["Text image search<br/>[3_search_images.py]"]
end

subgraph group_blip["BLIP examples"]
  node_blip_api["BLIP caption API<br/>[4_api_server.py]"]
  node_blip_demo["BLIP demo"]
  node_blip_cli["BLIP image captioning<br/>[1_caption_image.py]"]
end

node_visitor(("User"))
node_gemini{{"Google Gemini"}}
node_blip_model{{"BLIP model"}}

node_visitor -->|"uses"| node_web_ui
node_web_ui -.->|"submits media"| node_api
node_api -->|"serves page"| node_web_ui
node_api -->|"analyzes media"| node_media_analysis
node_media_analysis -->|"describes media"| node_gemini
node_api -->|"generates captions"| node_caption_generation
node_caption_generation -->|"requests captions"| node_gemini
node_caption_generation -->|"applies limits"| node_caption_rules
node_visitor -->|"runs"| node_cli
node_cli -->|"requests descriptions and captions"| node_gemini
node_visitor -->|"uses"| node_social_demo
node_social_demo -->|"requests descriptions and captions"| node_gemini
node_visitor -->|"uploads image"| node_blip_api
node_blip_api -->|"generates caption"| node_blip_model
node_visitor -->|"uses"| node_blip_demo
node_blip_demo -->|"generates caption"| node_blip_model
node_visitor -->|"runs"| node_blip_cli
node_blip_cli -->|"generates caption"| node_blip_model
node_visitor -->|"provides image folder"| node_index_builder
node_index_builder -->|"writes index and paths"| node_image_index
node_visitor -->|"provides text query"| node_image_search
node_image_search -->|"reads index and paths"| node_image_index

click node_web_ui "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/index.html"
click node_api "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py"
click node_media_analysis "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py"
click node_caption_generation "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py"
click node_caption_rules "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py"
click node_cli "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/6_social_media_captions.py"
click node_social_demo "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/7_streamlit_social_demo.py"
click node_blip_api "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/4_api_server.py"
click node_blip_demo "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/5_streamlit_demo.py"
click node_blip_cli "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/1_caption_image.py"
click node_index_builder "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/2_build_search_index.py"
click node_image_search "https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/3_search_images.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_ui,node_api,node_media_analysis,node_caption_generation,node_caption_rules,node_visitor toneBlue
class node_cli,node_social_demo toneAmber
class node_index_builder,node_image_index,node_image_search toneMint
class node_blip_api,node_blip_demo,node_blip_cli toneRose
class node_gemini,node_blip_model toneIndigo
```

## Components

### Web captioning

- [Web UI](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/index.html): `index.html`
- [Caption API](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py): `api/index.py`
- [Media analysis](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py): `api/index.py`
- [Caption generation](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py): `api/index.py`
- [Platform rules](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/api/index.py): `api/index.py`

### Captioning clients

- [Caption CLI](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/6_social_media_captions.py): `6_social_media_captions.py`
- [Social demo](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/7_streamlit_social_demo.py): `7_streamlit_social_demo.py`

### Image search

- [Build image index](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/2_build_search_index.py): `2_build_search_index.py`
- **FAISS image index**
- [Text image search](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/3_search_images.py): `3_search_images.py`

### BLIP examples

- [BLIP caption API](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/4_api_server.py): `4_api_server.py`
- [BLIP demo](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/5_streamlit_demo.py): `5_streamlit_demo.py`
- [BLIP image captioning](https://github.com/jagadeesh-boyalla-03/ai-powered-social-caption-generator/blob/main/1_caption_image.py): `1_caption_image.py`

### Other components

- **User**
- **Google Gemini**
- **BLIP model**

## Connections

- User → Web UI: uses (evidence: `README.md`)
- Web UI → Caption API: submits media
- Caption API → Web UI: serves page (evidence: `api/index.py`)
- Caption API → Media analysis: analyzes media (evidence: `api/index.py`)
- Media analysis → Google Gemini: describes media (evidence: `api/index.py`)
- Caption API → Caption generation: generates captions (evidence: `api/index.py`)
- Caption generation → Google Gemini: requests captions (evidence: `api/index.py`)
- Caption generation → Platform rules: applies limits (evidence: `api/index.py`)
- User → Caption CLI: runs (evidence: `6_social_media_captions.py`)
- Caption CLI → Google Gemini: requests descriptions and captions (evidence: `6_social_media_captions.py`)
- User → Social demo: uses (evidence: `7_streamlit_social_demo.py`)
- Social demo → Google Gemini: requests descriptions and captions (evidence: `7_streamlit_social_demo.py`)
- User → BLIP caption API: uploads image (evidence: `4_api_server.py`)
- BLIP caption API → BLIP model: generates caption (evidence: `4_api_server.py`)
- User → BLIP demo: uses (evidence: `5_streamlit_demo.py`)
- BLIP demo → BLIP model: generates caption (evidence: `5_streamlit_demo.py`)
- User → BLIP image captioning: runs (evidence: `1_caption_image.py`)
- BLIP image captioning → BLIP model: generates caption (evidence: `1_caption_image.py`)
- User → Build image index: provides image folder (evidence: `2_build_search_index.py`)
- Build image index → FAISS image index: writes index and paths (evidence: `2_build_search_index.py`)
- User → Text image search: provides text query (evidence: `3_search_images.py`)
- Text image search → FAISS image index: reads index and paths (evidence: `3_search_images.py`)
