# prince-khatri/coffee_roast architecture

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

- Interactive diagram: https://gitdiagram.com/prince-khatri/coffee_roast
- Repository: https://github.com/prince-khatri/coffee_roast

## Overview

##### Project type and purpose
- This is a small Python-based machine-learning pipeline for classifying coffee roasts.
- It provides two main scripts: one to train a TensorFlow/Keras model (`trainModel.py`), and one to run inference (`inference.py`).
- There is also a utility module for data loading and normalization (`coffeeRoastUtils.py`) and a GitHub Actions CI/CD workflow.

##### File structure
Top level:
- trainModel.py       → orchestrates data loading, model definition, training, and model serialization
- inference.py        → loads saved model and runs predictions on new inputs
- coffeeRoastUtils.py → contains dataset loading, normalization, and helper functions
- requirements.txt    → Python dependencies (TensorFlow, Keras, etc.)
- .github/workflows/  → CI pipeline YAML that installs deps, trains the model, and runs inference on each push

##### README for additional insights
- Training and inference commands are shell‐based scripts.
- CI workflow automates install → train → predict on GitHub push.
- Data sources are assumed to be local or specified within the utils module.
- The model is a simple feedforward NN for binary classification.

## Diagram (Mermaid)

```mermaid
graph TB
  subgraph "Local Development"
    Dev[/Developer\/CLI/]:::code
    DataSource[(Data Source)]:::dataset
    Preprocessor["Data Loader & Preprocessor"]:::code
    Trainer["Model Trainer"]:::code
    ModelArtifact[(Model Artifact)]:::model
    Inference["Inference Engine"]:::code
    Requirements["requirements.txt"]:::code
    Venv["Virtual Environment"]:::code
    Readme["Project Documentation (README.md)"]:::doc
    MakefileNode["Build & Automation Helper (Makefile)"]:::code
  end

  subgraph "CI Runner"
    CI["CI/CD Pipeline"]:::ci
  end

  Dev -->|triggers| Preprocessor
  DataSource -->|reads| Preprocessor
  Preprocessor -->|feeds| Trainer
  Trainer -->|outputs| ModelArtifact
  ModelArtifact -->|loaded by| Inference
  Preprocessor -->|used by| Inference

  Requirements -->|defines deps for| Venv
  Venv -->|runs scripts| Preprocessor
  Venv -->|runs scripts| Trainer
  Venv -->|runs scripts| Inference

  CI -->|install deps| Venv
  CI -->|train| Trainer
  CI -->|predict| Inference

  click Preprocessor "https://github.com/prince-khatri/coffee_roast/blob/main/coffeeRoastUtils.py"
  click Trainer "https://github.com/prince-khatri/coffee_roast/blob/main/trainModel.py"
  click Inference "https://github.com/prince-khatri/coffee_roast/blob/main/inference.py"
  click CI "https://github.com/prince-khatri/coffee_roast/blob/main/.github/workflows/python-app.yml"
  click Requirements "https://github.com/prince-khatri/coffee_roast/blob/main/requirements.txt"
  click MakefileNode "https://github.com/prince-khatri/coffee_roast/tree/main/Makefile"
  click Readme "https://github.com/prince-khatri/coffee_roast/blob/main/README.md"

  classDef code fill:#ADD8E6,stroke:#333,stroke-width:1px
  classDef dataset fill:#90EE90,stroke:#333,stroke-width:1px
  classDef model fill:#FFA500,stroke:#333,stroke-width:1px
  classDef ci fill:#DDA0DD,stroke:#333,stroke-width:1px
  classDef doc fill:#D3D3D3,stroke:#333,stroke-width:1px
```
