The Streamlit app should now be running. Open your web browser and navigate to:
If port 8501 is busy, Streamlit will automatically use the next available port (8502, 8503, etc.). Check the terminal output for the exact URL.
┌─────────────────────────────────────────────────────────┐
│ 🛠️ Engine Predictive Maintenance – Failure Prediction │
├─────────────────────────────────────────────────────────┤
│ │
│ This app predicts whether an engine is operating │
│ normally (0) or requires maintenance / at risk of │
│ failure (1) based on real-time sensor readings. │
│ │
│ Adjust the sensor values below and click Predict to │
│ see the model's classification and the probability of │
│ a potential fault. │
│ │
├─────────────────────────────────────────────────────────┤
│ Input Sensor Readings │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────┐ ┌─────────────────────┐ │
│ │ Engine RPM │ │ Coolant Pressure │ │
│ │ [800.0] │ │ [2.0] │ │
│ │ │ │ │ │
│ │ Lub Oil Pressure │ │ Lub Oil Temperature │ │
│ │ [3.0] │ │ [80.0] │ │
│ │ │ │ │ │
│ │ Fuel Pressure │ │ Coolant Temperature │ │
│ │ [10.0] │ │ [80.0] │ │
│ └─────────────────────┘ └─────────────────────┘ │
│ │
│ [Predict Button] │
│ │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ Sidebar: Model Source │
├─────────────────────────────────────────────────────────┤
│ Load model from: │
│ ○ Hugging Face Hub │
│ ● Local file │
│ │
│ Note: On Hugging Face Spaces, the model is typically │
│ loaded from the model hub. Locally, you can choose │
│ either source as long as you have run the training │
│ pipeline or configured your HF token. │
└─────────────────────────────────────────────────────────┘
- Choose "Local file" if you've run
python src/train.pylocally - Choose "Hugging Face Hub" if you've uploaded the model to HF and set
HF_TOKEN
Adjust the 6 sensor inputs:
-
Engine RPM (0-4000)
- Default: 800.0
- Typical range: 500-2000 RPM
-
Lub Oil Pressure (0-10 bar/kPa)
- Default: 3.0
- Typical range: 2-5 bar
-
Fuel Pressure (0-30 bar/kPa)
- Default: 10.0
- Typical range: 5-20 bar
-
Coolant Pressure (0-10 bar/kPa)
- Default: 2.0
- Typical range: 1-4 bar
-
Lub Oil Temperature (0-150°C)
- Default: 80.0
- Typical range: 70-90°C
-
Coolant Temperature (0-150°C)
- Default: 80.0
- Typical range: 70-90°C
After clicking the Predict button, you'll see one of two results:
✅ The engine is LIKELY OPERATING NORMALLY (probability of fault X.XX%).
🚨 The engine is LIKELY FAULTY / REQUIRES MAINTENANCE (probability XX.XX%).
- Engine RPM: 1200
- Lub Oil Pressure: 3.5
- Fuel Pressure: 12.0
- Coolant Pressure: 2.5
- Lub Oil Temperature: 82.0
- Coolant Temperature: 85.0
- Result: ✅ Normal operation (low fault probability)
- Engine RPM: 400
- Lub Oil Pressure: 1.5
- Fuel Pressure: 5.0
- Coolant Pressure: 1.0
- Lub Oil Temperature: 95.0
- Coolant Temperature: 100.0
- Result: 🚨 Requires maintenance (high fault probability)
- Check terminal for errors
- Verify port 8501 is available:
lsof -ti:8501 - Try a different port:
streamlit run src/app.py --server.port 8502
- For Local: Run
python src/train.pyfirst to createmodels/best_model.joblib - For HF: Set
HF_TOKENandHF_MODEL_REPOenvironment variables
- Activate virtual environment:
source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Clean, centered layout for easy input
- Two-column form for organized sensor inputs
- Real-time prediction with probability scores
- Color-coded results: Green for normal, Red for faulty
- Sidebar model selection for flexibility
- Responsive design that works on different screen sizes
When documenting this in your final report, you can:
- Take a screenshot of the input form
- Take a screenshot showing a "Normal" prediction
- Take a screenshot showing a "Faulty" prediction
- Include the URL:
http://localhost:8501(or your deployed HF Space URL)
- Test the app locally with different sensor values
- Deploy to Hugging Face Space using
python src/deploy_to_hf.py - Include screenshots in your final report/notebook
- Document the interface in your submission
The app is ready to use! 🎉