# omkar4965/ipl-win-predictor architecture

> Architecture diagram of the GitHub repository omkar4965/ipl-win-predictor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/omkar4965/ipl-win-predictor
- Repository: https://github.com/omkar4965/ipl-win-predictor

## Overview

##### Project type and purpose
- This is a full‑stack web application (single‑page, server‑driven UI) built with Streamlit that hosts a pre‑trained Scikit‑learn model.
- Purpose: Allow users to input live IPL match conditions and get a real‑time probability of a team winning.

##### File structure
- Top level:
– app.py            → Streamlit entry point and combined frontend/backend logic
– pipe.pkl          → Serialized ML pipeline (preprocessing + model)
– requirements.txt  → Python dependencies (Streamlit, scikit‑learn, pandas, etc.)
– README.md, LICENSE, .idea (IDE config)
- No separate frontend or backend directory: UI and inference logic are colocated in app.py.
- Deployment: Render (PaaS) is mentioned in README, indicating an external cloud host.

##### Extract architecture insights from README
- Frontend: Streamlit widgets for team, city, current match state
- Backend: Python code in app.py does feature engineering (runs left, balls left, CRR, RRR) then calls pipe.pkl
- Model: Scikit‑learn pipeline loaded from pipe.pkl
- Deployment: App runs on Render; external users connect via HTTPS

##### Main components
a. Client (Browser)
b. Streamlit Server (app.py)
c. Python Runtime & Dependencies
d. ML Pipeline (pipe.pkl)
e. Data Processing Modules (feature calculation)
f. Render Hosting Platform
g. (Optional) External Data Source for future “live match data”

##### Relationships & data flow
1. User opens URL → HTTPS request to Render
2. Render routes request to Streamlit process
3. Streamlit renders UI widgets in browser
4. User input → HTTP POST back to Streamlit
5. app.py computes derived features
6. app.py loads pipe.pkl → model.predict_proba
7. app.py returns probabilities to UI
8. Browser displays results

##### Architectural patterns & design principles
- Single process handles both presentation and business logic (Streamlit’s model)
- Pre‑trained ML pipeline decouples training from inference
- Stateless request handling: each user interaction recomputes from scratch
- Future extension: Microservice or data ingestion layer for live data

##### Technologies & frameworks
- Python 3.x, Streamlit (frontend + HTTP server)
- Scikit‑learn pipeline serialized in pipe.pkl
- pandas / numpy for data manipulation
- Render.com PaaS for continuous deployment
- requirements.txt for reproducible environment

##### Additional detail to capture
- In‑memory feature computation module inside app.py
- That there is no external database at present (state is ephemeral)
- Future extension point: “Live Match Data API” or “Data Ingestion Service”

##### Summary of what
- Components: Browser Client, Streamlit Server, Python Runtime (+ libs), ML Pipeline (pipe.pkl), Render Hosting
- Data flows: user input → feature calc → model inference → UI output

## Diagram (Mermaid)

```mermaid
flowchart TB
    Browser["Browser UI"]:::client
    Render["Render Hosting Platform"]:::cloud
    Streamlit["Streamlit Server\n(app.py)"]:::compute
    PythonRuntime["Python Runtime & Dependencies\n(requirements.txt)"]:::compute
    MLPipeline["ML Pipeline\n(pipe.pkl)"]:::data
    Docs["README.md"]:::docs
    Future["Live Match Data API"]:::cloud

    Browser -->|"HTTPS request"| Render
    Render -->|"Route request"| Streamlit
    Streamlit -->|"Loads dependencies"| PythonRuntime
    Streamlit -->|"Loads model"| MLPipeline
    MLPipeline -->|"predict_proba"| Streamlit
    Streamlit -->|"Render response"| Browser
    Docs -.->|"Deployment instructions"| Render
    Future -.-> Streamlit

    click Streamlit "https://github.com/omkar4965/ipl-win-predictor/blob/master/app.py"
    click MLPipeline "https://github.com/omkar4965/ipl-win-predictor/blob/master/pipe.pkl"
    click PythonRuntime "https://github.com/omkar4965/ipl-win-predictor/blob/master/requirements.txt"
    click Docs "https://github.com/omkar4965/ipl-win-predictor/blob/master/README.md"

    classDef compute fill:#1f77b4,stroke:#333,stroke-width:1px,color:#fff
    classDef data fill:#2ca02c,stroke:#333,stroke-width:1px,color:#000
    classDef client fill:#ff7f0e,stroke:#333,stroke-width:1px,color:#000
    classDef cloud fill:#9467bd,stroke:#333,stroke-width:1px,color:#fff
    classDef docs fill:#cccccc,stroke:#333,stroke-width:1px,color:#000

    style Future stroke-dasharray: 5 5,stroke:#9467bd,fill:none
```
