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