# ericblue/art-analyzer architecture

> Architecture diagram of the GitHub repository ericblue/art-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ericblue/art-analyzer
- Repository: https://github.com/ericblue/art-analyzer

## Overview

##### Main Components
- User/Client: The user interacts with the app via a web browser.
- Frontend (Streamlit UI): Represented by the streamlit_art.py (the main entry point). This component is responsible for handling image uploads and displaying results.
- Integration Layer: The part of the app that makes calls to OpenAI’s GPT-4 Vision API. This component processes images and receives analysis responses.
- External Service: OpenAI GPT-4 Vision API (and possibly GPT-4 for language processing), which provides image analysis and critique generation.
- Deployment Infrastructure: Include Docker (illustrated by the Dockerfile and Makefile) and optional deployment platforms like Heroku (noted in the README).

##### Relationships and Interactions
- The user uploads an artwork image through the Streamlit UI.
- The Streamlit UI sends the image to the API integration layer.
- The integration layer communicates with the OpenAI GPT-4 Vision API.
- The API returns the analysis results that the Streamlit UI then renders for the user.

##### Architectural Patterns
- The app follows a client-server model where the “frontend” (Streamlit app) is tightly coupled with the backend API calls.

##### Technologies Highlighted
- Python (the core language).
- Streamlit for the web UI.
- OpenAI GPT-4 Vision API.
- Docker for containerization.
- Heroku deployment (as an example of cloud hosting).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Subgraph
    subgraph "Client"
        U["User Browser"]:::client
    end

    %% Application Subgraph
    subgraph "Art Analyzer Application"
        A["Streamlit UI (streamlit_art.py)"]:::frontend
        B["API Integration Layer (Calls OpenAI API)"]:::backend
    end

    %% External Services Subgraph
    subgraph "External Services"
        C["OpenAI GPT-4 Vision API"]:::external
    end

    %% Deployment Infrastructure Subgraph
    subgraph "Deployment Infrastructure"
        D["Docker Container"]:::deployment
        DF["Dockerfile"]:::docker
        M["Makefile"]:::docker
        H["Heroku Deployment (Procfile)"]:::deployment
    end

    %% Flow of interactions
    U -->|"Uploads Artwork"| A
    A -->|"Sends Image"| B
    B -->|"Request Analysis"| C
    C -->|"Returns Analysis"| B
    B -->|"Displays Result"| A
    A -->|"Serves Interface"| U

    %% Deployment relationships
    D --- A
    H --- D
    DF --- D
    M --- D

    %% Click Events for Component Mapping
    click A "https://github.com/ericblue/art-analyzer/blob/main/streamlit_art.py"
    click B "https://github.com/ericblue/art-analyzer/blob/main/streamlit_art.py"
    click DF "https://github.com/ericblue/art-analyzer/tree/main/Dockerfile"
    click M "https://github.com/ericblue/art-analyzer/tree/main/Makefile"
    click H "https://github.com/ericblue/art-analyzer/tree/main/Procfile"

    %% Styles
    classDef client fill:#FAD7A0,stroke:#333,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef deployment fill:#F5B7B1,stroke:#943126,stroke-width:2px;
    classDef docker fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
```
