File size: 3,434 Bytes
318fd96 2fb45f0 318fd96 2fb45f0 318fd96 d2306e4 318fd96 2fb45f0 318fd96 2fb45f0 318fd96 2fb45f0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | ---
title: Intelligent Predictive Maintenance System
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
license: mit
---
# Intelligent Predictive Maintenance System
A Streamlit-based educational prototype demonstrating collaboration between a trained Machine Learning model and Agentic AI components.
## Architecture
```text
IoT Machine Parameters
β
IoT Data Agent
β
ML Prediction Agent
β
Trained Random Forest Pipeline
β
Failure Probability + Risk Level
β
Engineering Reasoning Agent
β
Qwen/Qwen2.5-0.5B-Instruct
β
Maintenance Action Agent
β
Structured Work Order
β
Human Engineer Approval
```
## Machine Learning Model
The application uses the pre-trained file:
```text
predictive_maintenance_rf_pipeline.pkl
```
The pipeline was trained separately using the AI4I 2020 predictive-maintenance dataset.
The expected raw input features are:
- Type
- Air temperature [K]
- Process temperature [K]
- Rotational speed [rpm]
- Torque [Nm]
- Tool wear [min]
The application does **not** retrain the Random Forest during startup. The exported pipeline is loaded and used only for inference.
## Local Reasoning Model
The engineering reasoning layer uses:
```text
Qwen/Qwen2.5-0.5B-Instruct
```
The model receives:
- Current sensor readings
- Random Forest failure probability
- Random Forest prediction
- Calculated risk level
The language model explains the prediction and proposes an educational maintenance response. It does not replace the Random Forest prediction.
## Agent Design
### Agent 1 β IoT Data Agent
Validates and structures incoming sensor data.
### Agent 2 β ML Prediction Agent
Calls the trained Random Forest pipeline as a prediction tool.
### Agent 3 β Engineering Reasoning Agent
Uses Qwen to interpret the ML result and sensor readings.
### Agent 4 β Maintenance Action Agent
Creates a structured predictive-maintenance work order.
### Human-in-the-Loop
A qualified engineer must validate any recommendation before a real maintenance, repair, or shutdown decision.
## Hugging Face Space Deployment
Create a new Hugging Face Space and choose:
```text
SDK: Docker
```
Upload these files to the root of the Space:
```text
app.py
requirements.txt
Dockerfile
README.md
predictive_maintenance_rf_pipeline.pkl
```
The final repository should look like:
```text
/
βββ app.py
βββ requirements.txt
βββ Dockerfile
βββ README.md
βββ predictive_maintenance_rf_pipeline.pkl
```
The Docker container exposes Streamlit on port `7860`, which matches the Hugging Face Space configuration.
## Hardware
The Random Forest model is lightweight.
The local Qwen 0.5B model can run on CPU, but response generation may take several seconds depending on the Space hardware. CPU Upgrade or GPU hardware will provide a smoother live demonstration.
## Important Model Compatibility Note
The exported Random Forest pipeline was created with scikit-learn 1.6.1, so this project pins:
```text
scikit-learn==1.6.1
```
Keeping the same scikit-learn version is important when loading a Joblib/Pickle model.
## Educational Disclaimer
This application is intended only for teaching and demonstration. It must not be used to make real industrial maintenance, repair, shutdown, or safety decisions without validation by qualified engineering personnel.
|