Streamlit App Interface Guide
π Accessing the App
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.
π± Interface Overview
Main Page Layout
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π οΈ 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. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π― How to Use the Interface
Step 1: Select Model Source (Sidebar)
- 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
Step 2: Enter Sensor Values
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
Step 3: Click "Predict"
After clicking the Predict button, you'll see one of two results:
β Normal Operation
β
The engine is LIKELY OPERATING NORMALLY (probability of fault X.XX%).
π¨ Faulty / Requires Maintenance
π¨ The engine is LIKELY FAULTY / REQUIRES MAINTENANCE (probability XX.XX%).
π Example Predictions
Example 1: Normal Engine
- 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)
Example 2: Faulty Engine
- 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)
π§ Troubleshooting
App Not Loading?
- Check terminal for errors
- Verify port 8501 is available:
lsof -ti:8501 - Try a different port:
streamlit run src/app.py --server.port 8502
Model Not Found Error?
- For Local: Run
python src/train.pyfirst to createmodels/best_model.joblib - For HF: Set
HF_TOKENandHF_MODEL_REPOenvironment variables
Import Errors?
- Activate virtual environment:
source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
π¨ Interface Features
- 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
πΈ Screenshots for Your Report
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)
π Next Steps
- 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! π