Spaces:
Sleeping
Sleeping
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.")
|