Skip to content

httpsanjay/iot-predictive-maintenance-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AIoT Predictive Maintenance

Predicting machine failure before it happens — powered by machine learning

Live Demo Python FastAPI scikit-learn License: MIT

🔗 Live App


📖 About

AIoT Predictive Maintenance is a web app that predicts machine failure risk in real time from live sensor readings. It uses a Random Forest classifier trained with scikit-learn, achieving around 93% overall accuracy, to flag whether a machine is likely to fail based on its current operating conditions — helping catch problems before they cause downtime.

Feed it temperature, speed, torque, and tool wear readings, and it returns a prediction, a failure probability, and a plain-language status.


✨ Features

  • 🎛️ Live sensor input form (machine type, temperature, speed, torque, tool wear)
  • 🤖 Real-time failure prediction via a trained Random Forest model
  • 📊 Failure probability score with a color-coded risk gauge
  • 🚦 Status indicator: Normal / Watch / Alert
  • ⚡ Fast, lightweight FastAPI backend

🛠️ Tech Stack

Layer Technology
Frontend HTML, CSS, JavaScript
Backend FastAPI
Model scikit-learn — Random Forest classifier
Dataset AI4I 2020 Predictive Maintenance Dataset
Accuracy ~93%
Deployment Render

📁 Project Structure

aiot-predictive-maintenance/
├── models/
│   ├── maintaince_model.pkl
│   └── preprocessor.pkl
├── static/
│   ├── script.js
│   └── style.css
├── templates/
│   └── index.html
├── Dockerfile
├── README.md
├── app.py
├── requirements.txt
└── schemas.py

🚀 Setup

  1. Clone the repository

    git clone https://github.com/httpsanjay/iot-predictive-maintenance-model.git
    
    cd iot-predictive-maintenance-model
  2. Create a virtual environment and install dependencies

    python -m venv venv
    source venv/bin/activate    
    pip install -r requirements.txt
  3. Run the app

    uvicorn app:app --reload
  4. Open http://localhost:8000 in your browser

⚠️ Note: The included Dockerfile isn't fully working yet — a fix is on the way. For now, run the app locally with the steps above, or use the live deployment linked at the top of this README.


🔌 API Reference

POST /predict

Request body

{
  "Type": "L",
  "Air temperature [K]": 298.1,
  "Process temperature [K]": 308.6,
  "Rotational speed [rpm]": 1500,
  "Torque [Nm]": 40.5,
  "Tool wear [min]": 120
}

Response

{
  "prediction": 0,
  "failure_probability": 34.1,
  "status": "No maintenance required"
}
Field Type Description
Type string Machine quality variant — L, M, or H
Air temperature [K] float Ambient air temperature
Process temperature [K] float Process temperature
Rotational speed [rpm] int Spindle rotational speed
Torque [Nm] float Applied torque
Tool wear [min] int Cumulative tool wear time
prediction int (0/1) 1 if the model classifies this as a failure case
failure_probability float (0–100) Model's confidence that the machine will fail
status string Human-readable status shown in the UI

License

Licensed under the MIT License.


Made with 🩷 by Sanjay

About

AIoT Predictive Maintenance system with a FastAPI backend, Random Forest ML model, interactive web UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Contributors