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