# sanfla/deploy_streamlit architecture

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

- Interactive diagram: https://gitdiagram.com/sanfla/deploy_streamlit
- Repository: https://github.com/sanfla/deploy_streamlit

## Overview

This repository contains several independent small applications rather than one integrated product: a NutriNest health-advice chatbot, a sentiment-analysis API with a Streamlit client, a general Streamlit UI demo, and standalone search-timing programs. The chatbot routes prompts by topic, predicts sentiment, and selects a matching response. The API trains Naive Bayes and SVM models from local Twitter CSVs and reports predictions and validation accuracy. Edges reflect only relationships visible in the excerpts; the empty README and unsampled files provide no additional evidence.

Main entry points: [`api.py`](https://github.com/sanfla/deploy_streamlit/blob/main/api.py) (Prediction endpoint), [`chatbot.py`](https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py) (Topic routing), [`tampilan.py`](https://github.com/sanfla/deploy_streamlit/blob/main/tampilan.py) (Prediction UI), [`twitter_training.csv`](https://github.com/sanfla/deploy_streamlit/blob/main/twitter_training.csv) (Twitter CSV data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_health["Health Chatbot"]
  node_chat_ui["Chat interface<br/>[chatbot.py]"]
  node_topic_router["Topic routing<br/>[chatbot.py]"]
  node_text_pipeline["Text preprocessing<br/>[chatbot.py]"]
  node_health_models["Topic classifiers<br/>[chatbot.py]"]
  node_response_selector["Response selection<br/>[chatbot.py]"]
  node_health_data["Training and response data"]
end

subgraph group_sentiment["Sentiment API"]
  node_api_client["Prediction UI<br/>[tampilan.py]"]
  node_api_service["Prediction endpoint<br/>[api.py]"]
  node_twitter_data["Twitter CSV data"]
  node_api_preprocess["Comment preprocessing<br/>[api.py]"]
  node_api_models["NB and SVM models<br/>[api.py]"]
end

subgraph group_demo["Streamlit Demo"]
  node_streamlit_demo["Interactive UI demo<br/>[streamlit.py]"]
end

subgraph group_search["Search Benchmarks"]
  node_go_search["Go search benchmark<br/>[aka.go]"]
  node_python_search["Python search benchmark<br/>[timeComplexity.py]"]
end

node_health_user(("Chat user"))
node_demo_user(("Demo user"))
node_search_user(("Benchmark user"))

node_health_user -->|"enters prompt"| node_chat_ui
node_chat_ui -->|"routes prompt"| node_topic_router
node_topic_router -->|"selects model"| node_health_models
node_topic_router -->|"selects responses"| node_response_selector
node_health_data -->|"supplies text"| node_text_pipeline
node_text_pipeline -->|"prepares training text"| node_health_models
node_health_models -->|"predicts sentiment"| node_response_selector
node_response_selector -->|"returns reply"| node_chat_ui
node_demo_user -->|"submits text"| node_api_client
node_api_client -->|"posts prediction"| node_api_service
node_twitter_data -->|"loads CSVs"| node_api_service
node_api_service -->|"cleans comments"| node_api_preprocess
node_api_preprocess -->|"provides features"| node_api_models
node_api_service -->|"predicts and evaluates"| node_api_models
node_demo_user -->|"uses controls"| node_streamlit_demo
node_search_user -->|"chooses search"| node_go_search
node_search_user -->|"chooses search"| node_python_search

click node_chat_ui "https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py"
click node_topic_router "https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py"
click node_text_pipeline "https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py"
click node_health_models "https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py"
click node_response_selector "https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py"
click node_api_client "https://github.com/sanfla/deploy_streamlit/blob/main/tampilan.py"
click node_api_service "https://github.com/sanfla/deploy_streamlit/blob/main/api.py"
click node_twitter_data "https://github.com/sanfla/deploy_streamlit/blob/main/twitter_training.csv"
click node_api_preprocess "https://github.com/sanfla/deploy_streamlit/blob/main/api.py"
click node_api_models "https://github.com/sanfla/deploy_streamlit/blob/main/api.py"
click node_streamlit_demo "https://github.com/sanfla/deploy_streamlit/blob/main/streamlit.py"
click node_go_search "https://github.com/sanfla/deploy_streamlit/blob/main/aka.go"
click node_python_search "https://github.com/sanfla/deploy_streamlit/blob/main/timeComplexity.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_chat_ui,node_topic_router,node_text_pipeline,node_health_models,node_response_selector,node_health_data,node_health_user,node_demo_user,node_search_user toneBlue
class node_api_client,node_api_service,node_twitter_data,node_api_preprocess,node_api_models toneAmber
class node_streamlit_demo toneMint
class node_go_search,node_python_search toneRose
```

## Components

### Health Chatbot

- [Chat interface](https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py): `chatbot.py`
- [Topic routing](https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py): `chatbot.py`
- [Text preprocessing](https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py): `chatbot.py`
- [Topic classifiers](https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py): `chatbot.py`
- [Response selection](https://github.com/sanfla/deploy_streamlit/blob/main/chatbot.py): `chatbot.py`
- **Training and response data**

### Sentiment API

- [Prediction UI](https://github.com/sanfla/deploy_streamlit/blob/main/tampilan.py): `tampilan.py`
- [Prediction endpoint](https://github.com/sanfla/deploy_streamlit/blob/main/api.py): `api.py`
- [Twitter CSV data](https://github.com/sanfla/deploy_streamlit/blob/main/twitter_training.csv): `twitter_training.csv`
- [Comment preprocessing](https://github.com/sanfla/deploy_streamlit/blob/main/api.py): `api.py`
- [NB and SVM models](https://github.com/sanfla/deploy_streamlit/blob/main/api.py): `api.py`

### Streamlit Demo

- [Interactive UI demo](https://github.com/sanfla/deploy_streamlit/blob/main/streamlit.py): `streamlit.py`

### Search Benchmarks

- [Go search benchmark](https://github.com/sanfla/deploy_streamlit/blob/main/aka.go): `aka.go`
- [Python search benchmark](https://github.com/sanfla/deploy_streamlit/blob/main/timeComplexity.py): `timeComplexity.py`

### Other components

- **Chat user**
- **Demo user**
- **Benchmark user**

## Connections

- Chat user → Chat interface: enters prompt (evidence: `chatbot.py`)
- Chat interface → Topic routing: routes prompt (evidence: `chatbot.py`)
- Topic routing → Topic classifiers: selects model (evidence: `chatbot.py`)
- Topic routing → Response selection: selects responses (evidence: `chatbot.py`)
- Training and response data → Text preprocessing: supplies text (evidence: `chatbot.py`)
- Text preprocessing → Topic classifiers: prepares training text (evidence: `chatbot.py`)
- Topic classifiers → Response selection: predicts sentiment (evidence: `chatbot.py`)
- Response selection → Chat interface: returns reply (evidence: `chatbot.py`)
- Demo user → Prediction UI: submits text (evidence: `tampilan.py`)
- Prediction UI → Prediction endpoint: posts prediction (evidence: `tampilan.py`)
- Twitter CSV data → Prediction endpoint: loads CSVs (evidence: `api.py`)
- Prediction endpoint → Comment preprocessing: cleans comments (evidence: `api.py`)
- Comment preprocessing → NB and SVM models: provides features (evidence: `api.py`)
- Prediction endpoint → NB and SVM models: predicts and evaluates (evidence: `api.py`)
- Demo user → Interactive UI demo: uses controls (evidence: `streamlit.py`)
- Benchmark user → Go search benchmark: chooses search (evidence: `aka.go`)
- Benchmark user → Python search benchmark: chooses search (evidence: `timeComplexity.py`)
