# nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm architecture

> Architecture diagram of the GitHub repository nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm
- Repository: https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm

## Overview

This repository serves a name-entity classifier through a FastAPI endpoint and two equivalent Streamlit interfaces. Each accepts a name, converts it to a padded token sequence, runs a saved attention model, and returns or displays a class and confidence. The model, tokenizer, and label classes are loaded from local artifacts. The README is empty; the graph reflects the inspected source excerpts, which do not show shared application code between the interfaces.

Main entry points: [`main.py`](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/main.py) (API prediction), [`app.py`](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/app.py) (UI prediction), [`streamlit_app.py`](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/streamlit_app.py) (UI prediction), [`model_attention_final.keras`](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/model_attention_final.keras) (Attention model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_api["Prediction API<br/>[main.py]"]
  node_streamlit_app["Streamlit UI<br/>[app.py]"]
  node_streamlit_alt["Streamlit UI<br/>[streamlit_app.py]"]
end

subgraph group_runtime["Classification runtime"]
  node_api_pipeline["API prediction<br/>[main.py]"]
  node_ui_pipeline["UI prediction<br/>[app.py]"]
  node_alt_pipeline["UI prediction<br/>[streamlit_app.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_model["Attention model"]
  node_tokenizer["Tokenizer<br/>[tokenizer.json]"]
  node_labels["Class labels<br/>[label_classes.pkl]"]
end

node_user(("User"))

node_user -->|"submits name"| node_api
node_api -->|"routes prediction"| node_api_pipeline
node_api_pipeline -->|"loads and encodes"| node_tokenizer
node_api_pipeline -->|"loads and predicts"| node_model
node_api_pipeline -->|"loads class"| node_labels
node_api -->|"returns class"| node_user
node_user -->|"enters name"| node_streamlit_app
node_streamlit_app -->|"runs prediction"| node_ui_pipeline
node_ui_pipeline -->|"loads and encodes"| node_tokenizer
node_ui_pipeline -->|"loads and predicts"| node_model
node_ui_pipeline -->|"loads class"| node_labels
node_streamlit_app -->|"displays result"| node_user
node_user -->|"enters name"| node_streamlit_alt
node_streamlit_alt -->|"runs prediction"| node_alt_pipeline
node_alt_pipeline -->|"loads and encodes"| node_tokenizer
node_alt_pipeline -->|"loads and predicts"| node_model
node_alt_pipeline -->|"loads class"| node_labels
node_streamlit_alt -->|"displays result"| node_user

click node_api "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/main.py"
click node_streamlit_app "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/app.py"
click node_streamlit_alt "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/streamlit_app.py"
click node_api_pipeline "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/main.py"
click node_ui_pipeline "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/app.py"
click node_alt_pipeline "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/streamlit_app.py"
click node_model "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/model_attention_final.keras"
click node_tokenizer "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/tokenizer.json"
click node_labels "https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/label_classes.pkl"

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_api,node_streamlit_app,node_streamlit_alt,node_user toneBlue
class node_api_pipeline,node_ui_pipeline,node_alt_pipeline toneAmber
class node_model,node_tokenizer,node_labels toneMint
```

## Components

### User interfaces

- [Prediction API](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/main.py): `main.py`
- [Streamlit UI](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/app.py): `app.py`
- [Streamlit UI](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/streamlit_app.py): `streamlit_app.py`

### Classification runtime

- [API prediction](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/main.py): `main.py`
- [UI prediction](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/app.py): `app.py`
- [UI prediction](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/streamlit_app.py): `streamlit_app.py`

### Model artifacts

- [Attention model](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/model_attention_final.keras): `model_attention_final.keras`
- [Tokenizer](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/tokenizer.json): `tokenizer.json`
- [Class labels](https://github.com/nyohleonard-nlktech/name-entity-classifier-or-ml-name-classifier-lstm/blob/main/label_classes.pkl): `label_classes.pkl`

### Other components

- **User**

## Connections

- User → Prediction API: submits name (evidence: `main.py`)
- Prediction API → API prediction: routes prediction (evidence: `main.py`)
- API prediction → Tokenizer: loads and encodes (evidence: `main.py`)
- API prediction → Attention model: loads and predicts (evidence: `main.py`)
- API prediction → Class labels: loads class (evidence: `main.py`)
- Prediction API → User: returns class (evidence: `main.py`)
- User → Streamlit UI: enters name (evidence: `app.py`)
- Streamlit UI → UI prediction: runs prediction (evidence: `app.py`)
- UI prediction → Tokenizer: loads and encodes (evidence: `app.py`)
- UI prediction → Attention model: loads and predicts (evidence: `app.py`)
- UI prediction → Class labels: loads class (evidence: `app.py`)
- Streamlit UI → User: displays result (evidence: `app.py`)
- User → Streamlit UI: enters name (evidence: `streamlit_app.py`)
- Streamlit UI → UI prediction: runs prediction (evidence: `streamlit_app.py`)
- UI prediction → Tokenizer: loads and encodes (evidence: `streamlit_app.py`)
- UI prediction → Attention model: loads and predicts (evidence: `streamlit_app.py`)
- UI prediction → Class labels: loads class (evidence: `streamlit_app.py`)
- Streamlit UI → User: displays result (evidence: `streamlit_app.py`)
