https://github.com/teonghan/predictor
A flexible Streamlit tool to load a trained model (.pkl) and generate predictions via single entry or batch upload โ all within a friendly web interface.
https://github.com/teonghan/predictor
prediction python streamlit
Last synced: about 8 hours ago
JSON representation
A flexible Streamlit tool to load a trained model (.pkl) and generate predictions via single entry or batch upload โ all within a friendly web interface.
- Host: GitHub
- URL: https://github.com/teonghan/predictor
- Owner: teonghan
- License: mit
- Created: 2025-07-22T07:08:46.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-08-07T23:29:49.000Z (11 months ago)
- Last Synced: 2025-08-08T01:07:02.192Z (11 months ago)
- Topics: prediction, python, streamlit
- Language: Python
- Homepage:
- Size: 424 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฎ Model Prediction App
A flexible Streamlit tool to **load a trained model (.pkl)** and generate predictions via single entry or batch upload โ all within a friendly web interface.
Try it online ๐ *https://predictor-pickle.streamlit.app/*
---
## ๐ Overview
This app helps you perform fast predictions using your trained machine learning model (classification or regression) by:
- ๐ค Uploading your `.pkl` model (with metadata)
- ๐ข Entering a single data row (with input UI)
- ๐ Uploading a full dataset (CSV or Excel)
- ๐งผ Auto-preprocessing your inputs (e.g., one-hot encoding, missing features)
---
## โ
Key Features
- Supports both **regression** and **classification**
- Visual mapping of class labels
- Shows prediction probabilities (if available)
- Downloadable batch predictions (CSV)
- Works with **categorical**, **numerical**, and **mixed** features
---
## ๐ Installation
### Option 1: One-Click macOS Installer
```bash
bash installer-macos-universal.sh
```
What it does:
- Detects Apple Silicon or Intel
- Installs Miniforge if not found
- Creates conda env (`modelprediction`)
- Adds Desktop shortcut with Automator icon
---
### Option 2: One-Click Windows Installer
```powershell
Right-click โ Run with PowerShell โ installer-windows.ps1
```
What it does:
- Detects Anaconda/Miniconda
- Creates or updates `modelprediction` env from `__environment__.yml`
- Creates launcher (`start-streamlit-app.ps1`)
- Adds Desktop shortcut (`Start Model Prediction App`)
- Generates uninstaller (`uninstall-streamlit-app.ps1`)
> ๐ก **Note**: Ensure Conda is installed before running.
---
### Option 3: Manual Setup
```bash
git clone https://github.com/teonghan/predictor.git
cd predictor
conda env create -f __environment__.yml
conda activate modelprediction
streamlit run app.py
```
---
## ๐ฆ Model Format Requirements
The uploaded `.pkl` must be a dictionary like:
```python
{
'model': trained_model,
'feature_names': [...],
'target_column': 'Your Target',
'is_regression': True or False,
'label_encoder': encoder_or_None,
'original_predictor_cols': [...],
'categorical_unique_values': {...},
'one_hot_encoded_feature_map': {...}
}
```
If somethingโs missing or malformed, the app will show a helpful error.
---
## ๐งช Input Data
You can either:
1. **Manually input** values for prediction (single-row)
2. **Upload batch files** (`.csv`, `.xlsx`) and download prediction results
Uploaded files must have all expected feature columns. Missing values will be auto-filled.
---
## ๐ฆ Dependencies
Included in `__environment__.yml` or `requirements.txt`:
- `streamlit`
- `pandas`
- `numpy`
- `scikit-learn`
- `lightgbm`
---
## ๐ License
MIT License โ free for personal, academic, or commercial use.
---
> ๐ง Predict smarter, faster โ without writing another line of code.