Nra commited on
Commit
f9b0a9a
·
verified ·
1 Parent(s): 220b836

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -45
app.py DELETED
@@ -1,45 +0,0 @@
1
- # (nra_upd_02)
2
- import streamlit as st
3
- import pandas as pd
4
- from huggingface_hub import hf_hub_download
5
- import joblib
6
- from config import HF_REPO_ID #this doesnt work and the reference is not found on HF run
7
-
8
-
9
- # HF_REPO_ID = "Nra/Machine-Failure-Prediction" # name is case sensitive
10
-
11
- # Download and load the model
12
- model_path = hf_hub_download(repo_id=HF_REPO_ID, filename="best_machine_failure_model_v1.joblib") # repo_id is case-sensitive
13
- model = joblib.load(model_path)
14
-
15
- # Streamlit UI for Machine Failure Prediction
16
- st.title("Machine Failure Prediction App")
17
- st.write("""
18
- This application predicts the likelihood of a machine failing based on its operational parameters.
19
- Please enter the sensor and configuration data below to get a prediction.
20
- """)
21
-
22
- # User input
23
- Type = st.selectbox("Machine Type", ["H", "L", "M"])
24
- air_temp = st.number_input("Air Temperature (K)", min_value=250.0, max_value=400.0, value=298.0, step=0.1)
25
- process_temp = st.number_input("Process Temperature (K)", min_value=250.0, max_value=500.0, value=324.0, step=0.1)
26
- rot_speed = st.number_input("Rotational Speed (RPM)", min_value=0, max_value=3000, value=1400)
27
- torque = st.number_input("Torque (Nm)", min_value=0.0, max_value=100.0, value=40.0, step=0.1)
28
- tool_wear = st.number_input("Tool Wear (min)", min_value=0, max_value=300, value=10)
29
-
30
- # Assemble input into DataFrame
31
- input_data = pd.DataFrame([{
32
- 'Air temperature': air_temp,
33
- 'Process temperature': process_temp,
34
- 'Rotational speed': rot_speed,
35
- 'Torque': torque,
36
- 'Tool wear': tool_wear,
37
- 'Type': Type
38
- }])
39
-
40
-
41
- if st.button("Predict Failure"):
42
- prediction = model.predict(input_data)[0]
43
- result = "Machine Failure" if prediction == 1 else "No Failure"
44
- st.subheader("Prediction Result:")
45
- st.success(f"The model predicts: **{result}**")