# adi-s28/machine_learning_project architecture

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

- Interactive diagram: https://gitdiagram.com/adi-s28/machine_learning_project
- Repository: https://github.com/adi-s28/machine_learning_project

## Overview

This is a Streamlit sentiment-analysis app with account/guest access, text classification, per-user result history, and sentiment-count visualization. The main workflow in app.py is: a user selects a page, submits text, the app predicts sentiment, stores the result, and displays history or metrics. streamlit_app.py provides a second, function-based implementation with its own data-loading and training flow. The excerpts omit parts of app.py’s model setup, so detailed preprocessing and dataset wiring are shown only where supported.

Main entry points: [`app.py`](https://github.com/adi-s28/machine_learning_project/blob/master/app.py) (Main app), [`streamlit_app.py`](https://github.com/adi-s28/machine_learning_project/blob/master/streamlit_app.py) (Alternate app), [`users.db`](https://github.com/adi-s28/machine_learning_project/blob/master/users.db) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Streamlit interface"]
  node_main_app["Main app<br/>[app.py]"]
  node_alt_app["Alternate app<br/>[streamlit_app.py]"]
  node_auth_ui["Login and signup<br/>[app.py]"]
  node_analysis_ui["Analysis page<br/>[app.py]"]
  node_metrics_ui["Metrics page<br/>[app.py]"]
end

subgraph group_identity["Accounts and sessions"]
  node_auth["User authentication<br/>[app.py]"]
  node_session["Session state<br/>[app.py]"]
end

subgraph group_analysis["Sentiment analysis"]
  node_model["Sentiment analyzer<br/>[app.py]"]
  node_tfidf_nb["TF-IDF and Naive Bayes<br/>[app.py]"]
  node_alt_data["Data loading and split<br/>[streamlit_app.py]"]
  node_alt_model["Training and prediction<br/>[streamlit_app.py]"]
end

subgraph group_persistence["Results and storage"]
  node_db_handler["Database handler<br/>[app.py]"]
  node_database[("SQLite database<br/>[users.db]")]
end

node_user(("User"))

node_user -->|"uses"| node_main_app
node_main_app -->|"routes pages"| node_auth_ui
node_main_app -->|"routes pages"| node_analysis_ui
node_main_app -->|"routes pages"| node_metrics_ui
node_main_app -->|"creates"| node_auth
node_main_app -->|"creates"| node_model
node_main_app -->|"creates"| node_db_handler
node_auth_ui -->|"authenticates"| node_auth
node_auth -->|"reads and writes"| node_db_handler
node_auth -->|"updates"| node_session
node_analysis_ui -->|"predicts sentiment"| node_model
node_model -->|"vectorizes and classifies"| node_tfidf_nb
node_analysis_ui -->|"stores and reads"| node_db_handler
node_metrics_ui -->|"loads counts"| node_db_handler
node_db_handler -->|"queries and updates"| node_database
node_user -.->|"uses alternative"| node_alt_app
node_alt_app -->|"loads and splits"| node_alt_data
node_alt_data -->|"provides training data"| node_alt_model
node_alt_app -->|"trains and predicts"| node_alt_model

click node_main_app "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_alt_app "https://github.com/adi-s28/machine_learning_project/blob/master/streamlit_app.py"
click node_auth_ui "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_analysis_ui "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_metrics_ui "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_auth "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_session "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_model "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_tfidf_nb "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_alt_data "https://github.com/adi-s28/machine_learning_project/blob/master/streamlit_app.py"
click node_alt_model "https://github.com/adi-s28/machine_learning_project/blob/master/streamlit_app.py"
click node_db_handler "https://github.com/adi-s28/machine_learning_project/blob/master/app.py"
click node_database "https://github.com/adi-s28/machine_learning_project/blob/master/users.db"

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_main_app,node_alt_app,node_auth_ui,node_analysis_ui,node_metrics_ui,node_user toneBlue
class node_auth,node_session toneAmber
class node_model,node_tfidf_nb,node_alt_data,node_alt_model toneMint
class node_db_handler,node_database toneRose
```

## Components

### Streamlit interface

- [Main app](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`
- [Alternate app](https://github.com/adi-s28/machine_learning_project/blob/master/streamlit_app.py): `streamlit_app.py`
- [Login and signup](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`
- [Analysis page](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`
- [Metrics page](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`

### Accounts and sessions

- [User authentication](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`
- [Session state](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`

### Sentiment analysis

- [Sentiment analyzer](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`
- [TF-IDF and Naive Bayes](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`
- [Data loading and split](https://github.com/adi-s28/machine_learning_project/blob/master/streamlit_app.py): `streamlit_app.py`
- [Training and prediction](https://github.com/adi-s28/machine_learning_project/blob/master/streamlit_app.py): `streamlit_app.py`

### Results and storage

- [Database handler](https://github.com/adi-s28/machine_learning_project/blob/master/app.py): `app.py`
- [SQLite database](https://github.com/adi-s28/machine_learning_project/blob/master/users.db): `users.db`

### Other components

- **User**

## Connections

- User → Main app: uses
- Main app → Login and signup: routes pages
- Main app → Analysis page: routes pages
- Main app → Metrics page: routes pages
- Main app → User authentication: creates
- Main app → Sentiment analyzer: creates
- Main app → Database handler: creates
- Login and signup → User authentication: authenticates
- User authentication → Database handler: reads and writes
- User authentication → Session state: updates
- Analysis page → Sentiment analyzer: predicts sentiment
- Sentiment analyzer → TF-IDF and Naive Bayes: vectorizes and classifies
- Analysis page → Database handler: stores and reads
- Metrics page → Database handler: loads counts
- Database handler → SQLite database: queries and updates
- User → Alternate app: uses alternative
- Alternate app → Data loading and split: loads and splits
- Data loading and split → Training and prediction: provides training data
- Alternate app → Training and prediction: trains and predicts
