# samamostafa03/art-critique-and-creation-tool architecture

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

- Interactive diagram: https://gitdiagram.com/samamostafa03/art-critique-and-creation-tool
- Repository: https://github.com/samamostafa03/art-critique-and-creation-tool

## Overview

##### Project type and purpose
- From the README and file tree, Art-Vision is an AI-powered microservices system exposing two sets of capabilities via REST APIs:
- Art Creation (cartoon, style-transfer, watercolor)
- Art Critique (description generation, genre/style classification, scoring)
- Each model lives in its own folder with a Dockerfile, requirements.txt, a FastAPI-style `app.py`, and notebooks.

##### File structure
- Top-level:
- AI-Models/Creation-Models/…
- AI-Models/Critique-Models/…
- README.md, Art-Vision-documentation.pdf
- Under each model directory:
- Dockerfile + .dockerignore → containerized service
- app.py → FastAPI (or similar) entrypoint exposing endpoints
- requirements.txt → Python dependencies
- No monolithic backend folder: each model is its own service

##### Insights from the README
- Uses FastAPI (invoked via `uvicorn … --reload`)
- Exposes a Postman/Swagger spec
- Relies on pre-trained networks (e.g. DenseNet-121) and in-folder model artifacts or JSONs

##### Main components
a. Client Layer
- Web or CLI client (not in repo)
- Postman / Third-party integrators
b. API Gateway / Load Balancer
- Single entrypoint (FastAPI routing layer or API Gateway)
- Routes incoming requests to the appropriate model service
c. Model Microservices (six services)
- Art-Creation: Cartoon Service, Style-Transfer Service, Watercolor Service
- Art-Critique: Description-Generator Service, Genre-Style Classifier Service, Scoring Service
d. Model Storage
- Pre-trained weights & JSON artifacts (mounted as volumes in each container)
e. Logging / Metrics (optional)
- Centralized logging/monitoring (e.g., ELK, Prometheus)
f. Documentation
- Swagger / OpenAPI UI (served by API Gateway)
- PDF user guide

##### Relationships and data flow
- Client → API Gateway (HTTP call)
- API Gateway → forwards to specific Dockerized Model Service
- Model Service → loads model weights → performs inference → returns JSON/image to API Gateway → API Gateway forwards to Client
- All services push logs/metrics to centralized Logging/Monitoring

##### Architectural patterns and principles
- Microservices: each AI model isolated in its own container
- Twelve-factor app: separate code, config, dependencies via requirements.txt and Dockerfiles
- API gateway pattern: central routing and security layer
- Containerization: all inference code runs in Docker, enabling consistent environments

##### Technologies and frameworks
- Python 3.x, FastAPI (uvicorn server)
- Deep learning backbones (DenseNet-121, custom CNNs)
- Docker & Docker Compose / Kubernetes for orchestration
- Jupyter notebooks for model experimentation

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Clients"
        Client["Web/CLI Clients & Postman"]:::client
    end

    subgraph "API Gateway & Docs"
        APIGW["API Gateway\n(FastAPI Routing)"]:::gateway
        Swagger["Swagger/OpenAPI UI"]:::doc
        PDF["PDF User Guide"]:::doc
    end

    subgraph "Art-Creation Services"
        subgraph Cartoon Service
            CR_app["app.py"]:::file
            CR_df["Dockerfile"]:::file
            CR_req["requirements.txt"]:::file
        end
        subgraph Style-Transfer Service
            ST_app["app.py"]:::file
            ST_df["Dockerfile"]:::file
            ST_req["requirements.txt"]:::file
        end
        subgraph Watercolor Service
            WC_app["app.py"]:::file
            WC_df["Dockerfile"]:::file
            WC_req["requirements.txt"]:::file
        end
    end

    subgraph "Art-Critique Services"
        subgraph Description-Generator Service
            DG_app["app.py"]:::file
            DG_df["Dockerfile"]:::file
            DG_req["requirements.txt"]:::file
        end
        subgraph Genre-Style Classifier Service
            GS_app["app.py"]:::file
            GS_df["Dockerfile"]:::file
            GS_req["requirements.txt"]:::file
            GC_json["genre_classes.json"]:::file
            SC_json["style_classes.json"]:::file
        end
        subgraph Scoring Service
            SC_app["app.py"]:::file
            SC_df["Dockerfile"]:::file
            SC_req["requirements.txt"]:::file
        end
    end

    subgraph "Shared Infrastructure"
        Storage["Model Storage"]:::infra
        Logging["Logging & Monitoring"]:::infra
    end

    %% Connections
    Client -->|"HTTP Request"| APIGW
    APIGW -->|"routes to"| CR_app
    APIGW -->|"routes to"| ST_app
    APIGW -->|"routes to"| WC_app
    APIGW -->|"routes to"| DG_app
    APIGW -->|"routes to"| GS_app
    APIGW -->|"routes to"| SC_app
    APIGW -->|serves| Swagger
    APIGW -->|serves| PDF

    CR_app -->|loads weights| Storage
    ST_app -->|loads weights| Storage
    WC_app -->|loads weights| Storage
    DG_app -->|loads weights| Storage
    GS_app -->|loads weights| Storage
    SC_app -->|loads weights| Storage

    CR_app -->|push logs| Logging
    ST_app -->|push logs| Logging
    WC_app -->|push logs| Logging
    DG_app -->|push logs| Logging
    GS_app -->|push logs| Logging
    SC_app -->|push logs| Logging

    %% Click Events
    click CR_app "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Creation-Models/cartoon/app.py"
    click CR_df "https://github.com/samamostafa03/art-critique-and-creation-tool/tree/main/AI-Models/Creation-Models/cartoon/Dockerfile"
    click CR_req "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Creation-Models/cartoon/requirements.txt"
    click ST_app "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Creation-Models/style-transfer/app.py"
    click ST_df "https://github.com/samamostafa03/art-critique-and-creation-tool/tree/main/AI-Models/Creation-Models/style-transfer/Dockerfile"
    click ST_req "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Creation-Models/style-transfer/requirements.txt"
    click WC_app "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Creation-Models/watercolor/app.py"
    click WC_df "https://github.com/samamostafa03/art-critique-and-creation-tool/tree/main/AI-Models/Creation-Models/watercolor/Dockerfile"
    click WC_req "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Creation-Models/watercolor/requirements.txt"
    click DG_app "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Critique-Models/description_generator/app.py"
    click DG_df "https://github.com/samamostafa03/art-critique-and-creation-tool/tree/main/AI-Models/Critique-Models/description_generator/Dockerfile"
    click DG_req "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Critique-Models/description_generator/requirements.txt"
    click GS_app "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Critique-Models/genres-and-styles/app.py"
    click GS_df "https://github.com/samamostafa03/art-critique-and-creation-tool/tree/main/AI-Models/Critique-Models/genres-and-styles/Dockerfile"
    click GS_req "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Critique-Models/genres-and-styles/requirements.txt"
    click SC_app "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Critique-Models/scores/app.py"
    click SC_df "https://github.com/samamostafa03/art-critique-and-creation-tool/tree/main/AI-Models/Critique-Models/scores/Dockerfile"
    click SC_req "https://github.com/samamostafa03/art-critique-and-creation-tool/blob/main/AI-Models/Critique-Models/scores/requirements.txt"

    %% Styles
    classDef client fill:#DDA0DD,stroke:#333
    classDef gateway fill:#ADD8E6,stroke:#333
    classDef doc fill:#E0E0E0,stroke:#333
    classDef creation fill:#90EE90,stroke:#333
    classDef critique fill:#FFA500,stroke:#333
    classDef infra fill:#D3D3D3,stroke:#333
    classDef file fill:#FFFFFF,stroke:#666,stroke-dasharray:2 2
```
