How chaithanya1904/ipl-victory-predictor works
Project Type & Purpose
• This is a full-stack ML web application built with Flask (Python) that performs real-time inference to predict the winner of an IPL match.
• It exposes a web UI (HTML/CSS via Jinja templates) that collects match conditions and displays prediction results computed by a pre-trained model.
File Structure
Top-level directories and files:
• app.py – the Flask application entry point (defines routes, loads the model, handles requests).
• model.joblib – serialized Random Forest model used at runtime.
• requirements.txt – Python dependencies (Flask, scikit-learn, pandas, numpy, etc.).
• templates/ – Jinja2 HTML templates (index.html).
• static/ – CSS, client-side assets (if any).
• Datasets/ (offline) – raw CSVs used for model training (not part of runtime).
• IPL_Predictor_Notebook.ipynb – exploratory notebook for feature engineering and training.
README for Insights
• Tech Stack: Frontend: HTML/CSS via Flask templates; Backend: Python + Flask; ML & Data: scikit-learn, pandas, numpy; Deployment: Render
• ML Workflow: Data ingestion → One-Hot Encoding → Model training (Random Forest, Logistic Regression) → Model export (.joblib)
• Runtime Workflow: Load model.joblib → Preprocess user input → Predict → Render result
Main Components & Their Relationships
a. User (Browser)
b. Frontend Layer
• HTML form in index.html
• CSS/JS in static/
c. Web Server / Backend (Flask in app.py)
• HTTP listener (Render or local)
• Request router (/, /predict)
• Data preprocessing module (One-Hot Encoding logic)
• Model inference module (loads model.joblib)
d. ML Model Artifact (model.joblib)
e. Offline Training Pipeline (outside runtime)
• Datasets/ + IPL_Predictor_Notebook.ipynb
f. Deployment Environment (Render)
• WSGI server (Gunicorn or default Flask server)
• Container/VM
Architectural Patterns & Principles
• MVC-like Separation:
• Model = model.joblib + preprocessing code
• View = Jinja templates + static assets
• Controller = Flask routes in app.py
• Single Responsibility:
• app.py orchestrates only request handling and prediction
• Training code confined to Jupyter Notebook / offline process
• Stateless Inference Service:
• No persistent database; each prediction is independent
• Modularization:
• Potential to extract preprocessing into its own module