File size: 948 Bytes
232d3b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd
import numpy as np

st.set_page_config(page_title="Machine Failure Predictor")

st.title("πŸ› οΈ Machine Failure Prediction App")

# Upload sensor data
uploaded_file = st.file_uploader("Upload sensor data (CSV)", type="csv")

if uploaded_file:
    data = pd.read_csv(uploaded_file)
    st.subheader("πŸ” Sensor Data Preview")
    st.dataframe(data.head())

    # Example health score calculation (mock)
    st.subheader("πŸ“Š Predicted Health Score")
    health_score = np.random.uniform(30, 100)
    st.metric("Health Score", f"{health_score:.2f}%", delta_color="inverse")

    if health_score < 40:
        st.error("⚠️ High Risk of Failure!")
    elif health_score < 70:
        st.warning("⚠️ Moderate Risk")
    else:
        st.success("βœ… Low Risk")

    # Line chart
    st.subheader("πŸ“ˆ Sensor Trends")
    st.line_chart(data)
else:
    st.info("Please upload a CSV file to begin.")