An open API service indexing awesome lists of open source software.

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.

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.