# iamdeepakhr/ai-powered-image-analysis-using-python architecture

> Architecture diagram of the GitHub repository iamdeepakhr/ai-powered-image-analysis-using-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamdeepakhr/ai-powered-image-analysis-using-python
- Repository: https://github.com/iamdeepakhr/ai-powered-image-analysis-using-python

## Overview

##### Project type and purpose
- NexLens is a lightweight, monolithic full-stack (UI + API integration) web application.
- It provides a Streamlit-based frontend for users to upload images and prompts, and a Python backend that calls Google’s Gemini API to perform AI-powered image analysis.

##### File structure
- Top level:
- app.py – main Streamlit application driving both the UI and backend logic
- requirements.txt – Python dependencies
- Procfile – deployment entrypoint (e.g., for Heroku/Render)
- .env – runtime environment for storing the GENAI_API_KEY
- README.md, LICENSE, .gitignore – documentation and config
- No separate “frontend” or “backend” folders: app.py handles both.

##### README for additional insights
- Technology stack: Streamlit (UI), Pillow (in-process image handling), Python, dotenv, Gemini API.
- Features: real-time AI responses, image format support, secure API key management, error handling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    User["Browser / User"]:::user

    %% Config
    Env[".env / Config"]:::config

    %% Deployment
    Proc["Procfile"]:::deployment
    Cloud["Cloud Host (Render/Heroku)"]:::deployment

    %% External Service
    GAPI["Google Gemini API"]:::external

    %% Streamlit Server Container
    subgraph "Streamlit Server"
        direction TB
        UI["Streamlit UI"]:::presentation
        Img["Image Preprocessing (Pillow)"]:::logic
        AI["AI Integration (Gemini API Client)"]:::logic
    end

    %% Relationships
    User -->|"upload image & prompt"| UI
    UI -->|"load & validate image"| Img
    Img -->|"prepare data"| AI
    AI -->|"HTTP request/response"| GAPI
    GAPI -->|"API response"| AI
    AI -->|"display insights"| UI

    Env -->|"config at startup"| UI
    Proc -->|"launch app.py"| Cloud
    Cloud -->|"hosts Streamlit Server"| UI

    %% Click Events
    click UI "https://github.com/iamdeepakhr/ai-powered-image-analysis-using-python/blob/main/app.py"
    click Img "https://github.com/iamdeepakhr/ai-powered-image-analysis-using-python/blob/main/app.py"
    click AI "https://github.com/iamdeepakhr/ai-powered-image-analysis-using-python/blob/main/app.py"
    click Env "https://github.com/iamdeepakhr/ai-powered-image-analysis-using-python/blob/main/.env"
    click Proc "https://github.com/iamdeepakhr/ai-powered-image-analysis-using-python/tree/main/Procfile"

    %% Styles
    classDef presentation fill:#D6EAF8,stroke:#3498DB,stroke-width:2px;
    classDef logic fill:#EBDEF0,stroke:#8E44AD,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px,stroke-dasharray: 5 5;
    classDef config fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px,stroke-dasharray: 2 2;
    classDef deployment fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
```
