Spaces:
Sleeping
Sleeping
Download app.py from Snigs98/Predictive_Maintenance_GUI: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/Snigs98/Predictive_Maintenance_GUI/resolve/main/app.py
- Command line
-
hf download hf://spaces/Snigs98/Predictive_Maintenance_GUI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Snigs98/Predictive_Maintenance_GUI/resolve/main/app.py
1.3 kB
| import gradio as gr | |
| import pandas as pd | |
| import numpy as np | |
| import joblib | |
| # Load the trained model | |
| model = joblib.load("predictive_maintenance_model.pkl") | |
| # Define the prediction function | |
| def predict_maintenance(feature1, feature2, feature3, feature4,feature5,feature6,feature7,feature8,feature9,feature10): | |
| input_data = np.array([[feature1, feature2, feature3, feature4,feature5,feature6,feature7,feature8,feature9,feature10]]) # Modify according to your dataset | |
| prediction = model.predict(input_data) | |
| return f"Predicted Maintenance Requirement: {prediction[0]}" | |
| # Create the Gradio interface | |
| interface = gr.Interface( | |
| fn=predict_maintenance, | |
| inputs=[ | |
| gr.Number(label="Feature 1"), | |
| gr.Number(label="Feature 2"), | |
| gr.Number(label="Feature 3"), | |
| gr.Number(label="Feature 4"), | |
| gr.Number(label="Feature 5"), | |
| gr.Number(label="Feature 6"), | |
| gr.Number(label="Feature 7"), | |
| gr.Number(label="Feature 8"), | |
| gr.Number(label="Feature 9"), | |
| gr.Number(label="Feature 10"), | |
| ], | |
| outputs=gr.Textbox(label="Prediction"), | |
| title="Predictive Maintenance for Industrial Equipment", | |
| description="Enter sensor readings to predict maintenance requirements." | |
| ) | |
| # Launch the app | |
| interface.launch() | |