# akif987/customer_support_ticket_category_prediction architecture

> Architecture diagram of the GitHub repository akif987/customer_support_ticket_category_prediction, 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/akif987/customer_support_ticket_category_prediction
- Repository: https://github.com/akif987/customer_support_ticket_category_prediction

## Overview

This repository is a customer-support ticket classifier with a Streamlit interface, a trainable TF-IDF/Logistic Regression model, and optional Groq-generated customer replies with rule-based fallback. The main workflow is ticket entry → category prediction → suggested response. Training and inference paths are represented separately. Source excerpts are partial; the preprocessing source refers to lowercase `data/tickets.csv`, while the tree lists `Data/tickets.csv`, so that dataset link is not asserted.

Main entry points: [`src/train.py`](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/train.py) (Model trainer), [`src/app.py`](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/app.py) (Streamlit app), [`src/predict.py`](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/predict.py) (Ticket predictor), [`model/classifier.pkl`](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/model/classifier.pkl) (Model artifacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Ticket interface"]
  node_app["Streamlit app<br/>[app.py]"]
end

subgraph group_inference["Classification"]
  node_predict["Ticket predictor<br/>[predict.py]"]
  node_model_files["Model artifacts<br/>[classifier.pkl]"]
  node_vectorizer_file["TF-IDF artifact"]
end

subgraph group_training["Model training"]
  node_preprocessing["Data preparation<br/>[preprocessing.py]"]
  node_training_data["Ticket data<br/>[tickets.csv]"]
  node_trainer["Model trainer<br/>[train.py]"]
end

subgraph group_responses["Response generation"]
  node_response_generation["Suggested responses<br/>[predict.py]"]
  node_fallback["Rule-based replies<br/>[predict.py]"]
end

node_customer(("Support user"))
node_groq{{"Groq API"}}

node_customer -->|"submits ticket"| node_app
node_app -->|"requests prediction"| node_predict
node_predict -->|"loads classifier"| node_model_files
node_predict -->|"loads vectorizer"| node_vectorizer_file
node_app -->|"requests reply"| node_response_generation
node_response_generation -.->|"generates reply"| node_groq
node_response_generation -->|"uses fallback"| node_fallback
node_trainer -->|"loads and splits"| node_preprocessing
node_trainer -->|"writes classifier"| node_model_files
node_trainer -->|"writes vectorizer"| node_vectorizer_file

click node_app "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/app.py"
click node_predict "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/predict.py"
click node_model_files "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/model/classifier.pkl"
click node_vectorizer_file "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/model/tfidf_vectorizer.pkl"
click node_preprocessing "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/preprocessing.py"
click node_training_data "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/Data/tickets.csv"
click node_trainer "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/train.py"
click node_response_generation "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/predict.py"
click node_fallback "https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/predict.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_app,node_customer toneBlue
class node_predict,node_model_files,node_vectorizer_file toneAmber
class node_preprocessing,node_training_data,node_trainer,node_groq toneMint
class node_response_generation,node_fallback toneRose
```

## Components

### Ticket interface

- [Streamlit app](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/app.py): `src/app.py`

### Classification

- [Ticket predictor](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/predict.py): `src/predict.py`
- [Model artifacts](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/model/classifier.pkl): `model/classifier.pkl`
- [TF-IDF artifact](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/model/tfidf_vectorizer.pkl): `model/tfidf_vectorizer.pkl`

### Model training

- [Data preparation](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Ticket data](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/Data/tickets.csv): `Data/tickets.csv`
- [Model trainer](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/train.py): `src/train.py`

### Response generation

- [Suggested responses](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/predict.py): `src/predict.py`
- [Rule-based replies](https://github.com/akif987/customer_support_ticket_category_prediction/blob/main/src/predict.py): `src/predict.py`

### Other components

- **Support user**
- **Groq API**

## Connections

- Support user → Streamlit app: submits ticket
- Streamlit app → Ticket predictor: requests prediction
- Ticket predictor → Model artifacts: loads classifier
- Ticket predictor → TF-IDF artifact: loads vectorizer
- Streamlit app → Suggested responses: requests reply
- Suggested responses → Groq API: generates reply
- Suggested responses → Rule-based replies: uses fallback
- Model trainer → Data preparation: loads and splits
- Model trainer → Model artifacts: writes classifier
- Model trainer → TF-IDF artifact: writes vectorizer
