# prerna2415/fabricnet architecture

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

- Interactive diagram: https://gitdiagram.com/prerna2415/fabricnet
- Repository: https://github.com/prerna2415/fabricnet

## Overview

##### Project type and purpose
- This is a containerized Python application whose primary goal is to package and run a pre-trained Keras “FabricNet” model inside Docker.
- Key indicators: presence of Dockerfile, .devcontainer folder, Python scripts (main_app.py), Keras model files (*.keras), requirements.txt, runtime.txt.

##### File structure
Top-level:
- .devcontainer/ – VS Code devcontainer configuration (dev workflow)
- Dockerfile – instructions to build a Docker image
- main_app.py + requirements.txt + runtime.txt – entry point and dependency lists
- fabricnet_best_fold_3.keras – model file at root (duplicate in main/)
- main/ – likely source folder with the same artifacts (model, app and requirements)
Patterns:
- Single container app (no microservices)
- Dev environment (VS Code Remote-Containers) and production container share same Dockerfile

##### README
- Very brief: “FABRIC NET DOCKERIZATION CODE”
- Implies focus on container orchestration of the model rather than multi-service orchestration

##### Main components (to be shown
a. Developer Workstation
– VS Code with Remote-Containers extension reading .devcontainer/devcontainer.json
b. Docker Build
– Docker daemon using Dockerfile + requirements.txt + runtime.txt
c. Docker Image
– Base Python runtime (e.g. from runtime.txt)
– Installed Python dependencies (from requirements.txt)
– Keras model file (fabricnet_best_fold_3.keras) copied into image
– main_app.py copied into image as container entrypoint
d. Docker Container at runtime
– Runs main_app.py which loads the FabricNet model and serves inference
e. (Optional) External Resources
– GPU or CPU hardware
– Logging or monitoring if configured

##### Relationships & data flow
- Developer Workstation → builds → Docker Image
- Docker Image → instantiated as → Docker Container
- Docker Container reads → model file and Python dependencies
- main_app.py processes inputs → runs inference → outputs predictions

##### Architectural patterns & design principles
- Single-container deployment pattern
- Clear separation between development environment definition (.devcontainer) and production Dockerfile
- Immutable infrastructure: build once, run anywhere

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Environment
    subgraph "Developer Workstation"
        DevWS["VS Code (Remote-Containers)"]:::dev
        DevConfig[".devcontainer/devcontainer.json"]:::dev
    end
    DevWS -->|"uses config"| DevConfig
    DevWS -->|"triggers build"| DockerDaemon

    click DevConfig "https://github.com/prerna2415/fabricnet/blob/main/.devcontainer/devcontainer.json"
    click DevWS "https://github.com/prerna2415/fabricnet/blob/main/.devcontainer/devcontainer.json"

    %% Build Stage
    subgraph "Docker Build"
        DockerDaemon["Docker Daemon"]:::build
        DockerfileNode["Dockerfile"]:::build
        ReqProd["requirements.txt"]:::artifact
        RuntimeSpec["runtime.txt"]:::artifact
    end
    DockerDaemon -->|"reads"| DockerfileNode
    DockerfileNode -->|"install deps"| ReqProd
    DockerfileNode -->|"set runtime"| RuntimeSpec
    DockerDaemon -->|"build image"| DockerImage

    click DockerfileNode "https://github.com/prerna2415/fabricnet/tree/main/Dockerfile"
    click ReqProd "https://github.com/prerna2415/fabricnet/blob/main/requirements.txt"
    click RuntimeSpec "https://github.com/prerna2415/fabricnet/blob/main/runtime.txt"

    %% Docker Image
    DockerImage["Docker Image"]:::image

    %% Model and App Copy
    DockerImage -->|"copy model"| ModelProd
    DockerImage -->|"copy entrypoint"| AppProd

    ModelProd["[(fabricnet_best_fold_3.keras)]"]:::artifact
    AppProd["main_app.py"]:::artifact

    click ModelProd "https://github.com/prerna2415/fabricnet/blob/main/fabricnet_best_fold_3.keras"
    click AppProd "https://github.com/prerna2415/fabricnet/blob/main/main_app.py"

    %% Runtime Container
    DockerImage -->|"run container"| Container
    subgraph "Docker Container"
        Container["Container Instance"]:::container
        Container -->|"load model"| ModelProd
        Container -->|"execute"| AppProd
        Container -->|"compute"| GPU
    end

    GPU["GPU / CPU"]:::ext

    classDef dev fill:#f9f,stroke:#333,stroke-width:1px
    classDef build fill:#ff9,stroke:#333,stroke-width:1px
    classDef image fill:#9cf,stroke:#333,stroke-width:1px
    classDef container fill:#9f9,stroke:#333,stroke-width:1px
    classDef artifact fill:#fcc,stroke:#333,stroke-width:1px
    classDef ext fill:#ccf,stroke:#333,stroke-width:1px
```
