# meiramalu/iis architecture

> Architecture diagram of the GitHub repository meiramalu/iis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meiramalu/iis
- Repository: https://github.com/meiramalu/iis

## Overview

This repository classifies audio as classical or rock, with a Flask interface for browsing evaluation results, classifying an uploaded song, and retraining. The main workflow extracts audio features, trains a PyTorch classifier, and returns a genre prediction; offline evaluation and saved artifacts support the web app. Source excerpts show the key calls and file reads/writes. The interface template’s detailed behavior and other unsampled implementation details are not inferred.

Main entry points: [`app.py`](https://github.com/meiramalu/iis/blob/main/app.py) (Flask routes), [`genre_classifier.py`](https://github.com/meiramalu/iis/blob/main/genre_classifier.py) (Training workflow), [`dataset.csv`](https://github.com/meiramalu/iis/blob/main/dataset.csv) (Feature dataset), [`metrics.json`](https://github.com/meiramalu/iis/blob/main/metrics.json) (Evaluation results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Flask routes<br/>[app.py]"]
  node_page["Web page<br/>[index.html]"]
  node_upload["Uploaded audio"]
end

subgraph group_audio["Audio and dataset"]
  node_audiofiles["Genre audio corpus"]
  node_extract["Feature extraction"]
  node_builder["Dataset builder"]
end

subgraph group_model["Model and evaluation"]
  node_orchestrator["Training workflow"]
  node_trainer["Neural-network training"]
  node_evaluation["Leave-one-out evaluation"]
  node_prediction["Genre prediction"]
end

subgraph group_artifacts["Saved artifacts"]
  node_csv["Feature dataset<br/>[dataset.csv]"]
  node_metrics["Evaluation results<br/>[metrics.json]"]
  node_model_file["Trained model<br/>[model.pt]"]
end

node_visitor(("User"))

node_visitor -->|"uses"| node_flask
node_flask -->|"renders"| node_page
node_visitor -->|"submits song"| node_upload
node_upload -->|"uploaded file"| node_flask
node_flask -->|"extracts features"| node_extract
node_flask -->|"predicts genre"| node_prediction
node_audiofiles -->|"audio inputs"| node_builder
node_builder -->|"extracts features"| node_extract
node_builder -->|"writes dataset"| node_csv
node_orchestrator -->|"builds dataset"| node_builder
node_orchestrator -->|"trains models"| node_trainer
node_orchestrator -->|"evaluates predictions"| node_evaluation
node_orchestrator -->|"writes metrics"| node_metrics
node_orchestrator -->|"saves model"| node_model_file
node_trainer -->|"provides model"| node_prediction
node_evaluation -->|"scores held-out songs"| node_prediction
node_flask -->|"loads checkpoint"| node_model_file
node_flask -->|"reads results"| node_metrics
node_flask -->|"reads dataset"| node_csv
node_flask -->|"retrain request"| node_orchestrator

click node_flask "https://github.com/meiramalu/iis/blob/main/app.py"
click node_page "https://github.com/meiramalu/iis/blob/main/templates/index.html"
click node_audiofiles "https://github.com/meiramalu/iis/tree/main/data"
click node_extract "https://github.com/meiramalu/iis/blob/main/genre_classifier.py"
click node_builder "https://github.com/meiramalu/iis/blob/main/genre_classifier.py"
click node_csv "https://github.com/meiramalu/iis/blob/main/dataset.csv"
click node_orchestrator "https://github.com/meiramalu/iis/blob/main/genre_classifier.py"
click node_trainer "https://github.com/meiramalu/iis/blob/main/genre_classifier.py"
click node_evaluation "https://github.com/meiramalu/iis/blob/main/genre_classifier.py"
click node_metrics "https://github.com/meiramalu/iis/blob/main/metrics.json"
click node_model_file "https://github.com/meiramalu/iis/blob/main/model.pt"
click node_prediction "https://github.com/meiramalu/iis/blob/main/genre_classifier.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_flask,node_page,node_upload,node_visitor toneBlue
class node_audiofiles,node_extract,node_builder toneAmber
class node_orchestrator,node_trainer,node_evaluation,node_prediction toneMint
class node_csv,node_metrics,node_model_file toneRose
```

## Components

### Web interface

- [Flask routes](https://github.com/meiramalu/iis/blob/main/app.py): `app.py`
- [Web page](https://github.com/meiramalu/iis/blob/main/templates/index.html): `templates/index.html`
- **Uploaded audio**

### Audio and dataset

- [Genre audio corpus](https://github.com/meiramalu/iis/tree/main/data): `data`
- [Feature extraction](https://github.com/meiramalu/iis/blob/main/genre_classifier.py): `genre_classifier.py`
- [Dataset builder](https://github.com/meiramalu/iis/blob/main/genre_classifier.py): `genre_classifier.py`

### Model and evaluation

- [Training workflow](https://github.com/meiramalu/iis/blob/main/genre_classifier.py): `genre_classifier.py`
- [Neural-network training](https://github.com/meiramalu/iis/blob/main/genre_classifier.py): `genre_classifier.py`
- [Leave-one-out evaluation](https://github.com/meiramalu/iis/blob/main/genre_classifier.py): `genre_classifier.py`
- [Genre prediction](https://github.com/meiramalu/iis/blob/main/genre_classifier.py): `genre_classifier.py`

### Saved artifacts

- [Feature dataset](https://github.com/meiramalu/iis/blob/main/dataset.csv): `dataset.csv`
- [Evaluation results](https://github.com/meiramalu/iis/blob/main/metrics.json): `metrics.json`
- [Trained model](https://github.com/meiramalu/iis/blob/main/model.pt): `model.pt`

### Other components

- **User**

## Connections

- User → Flask routes: uses (evidence: `README.md`)
- Flask routes → Web page: renders (evidence: `app.py`)
- User → Uploaded audio: submits song (evidence: `README.md`)
- Uploaded audio → Flask routes: uploaded file (evidence: `app.py`)
- Flask routes → Feature extraction: extracts features (evidence: `app.py`)
- Flask routes → Genre prediction: predicts genre (evidence: `app.py`)
- Genre audio corpus → Dataset builder: audio inputs (evidence: `README.md`)
- Dataset builder → Feature extraction: extracts features (evidence: `genre_classifier.py`)
- Dataset builder → Feature dataset: writes dataset (evidence: `genre_classifier.py`)
- Training workflow → Dataset builder: builds dataset (evidence: `genre_classifier.py`)
- Training workflow → Neural-network training: trains models (evidence: `genre_classifier.py`)
- Training workflow → Leave-one-out evaluation: evaluates predictions (evidence: `genre_classifier.py`)
- Training workflow → Evaluation results: writes metrics (evidence: `genre_classifier.py`)
- Training workflow → Trained model: saves model (evidence: `genre_classifier.py`)
- Neural-network training → Genre prediction: provides model (evidence: `genre_classifier.py`)
- Leave-one-out evaluation → Genre prediction: scores held-out songs (evidence: `genre_classifier.py`)
- Flask routes → Trained model: loads checkpoint (evidence: `app.py`)
- Flask routes → Evaluation results: reads results (evidence: `app.py`)
- Flask routes → Feature dataset: reads dataset (evidence: `app.py`)
- Flask routes → Training workflow: retrain request (evidence: `app.py`)
