Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import pandas as pd | |
| from huggingface_hub import hf_hub_download | |
| import joblib | |
| # Download and load the trained model | |
| model_path = hf_hub_download(repo_id="Ankurkamboj21/Enginedataset1", filename="best_Model_v1.joblib") | |
| model = joblib.load(model_path) | |
| # Streamlit UI | |
| st.title("Ankur Predictive Maintenance") | |
| st.write(""" | |
| This application predicts Engine Condition. | |
| """) | |
| # User input | |
| engine_rpm=st.number_input("Engine rpm") | |
| lub_oil_pressure=st.number_input("Lub oil pressure") | |
| fuel_pressure=st.number_input("Fuel pressure") | |
| coolant_pressure=st.number_input("Coolant pressure") | |
| lub_oil_temp=st.number_input("lub oil temp") | |
| coolant_temp=st.number_input("Coolant temp") | |
| # Assemble input into DataFrame | |
| input_data = pd.DataFrame([{ | |
| 'Engine rpm': engine_rpm, | |
| 'Lub oil pressure': lub_oil_pressure, | |
| 'Fuel pressure': fuel_pressure, | |
| 'Coolant pressure': coolant_pressure, | |
| 'lub oil temp': lub_oil_temp, | |
| 'Coolant temp': coolant_temp | |
| }]) | |
| # Predict button | |
| if st.button("Submit"): | |
| prediction = model.predict(input_data)[0] | |
| results="Engine Condition is Good" if prediction==1 else "Engine Condition is not Good" | |
| st.subheader("Prediction Result:") | |
| st.success(f"Estimated Ad Revenue: {results}") | |