khanikho8's picture
Create app.py
232d3b0 verified
raw
history blame contribute delete
948 Bytes
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.")