Snigs98 commited on
Commit
cec404d
·
verified ·
1 Parent(s): f7015d3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import numpy as np
4
+ import joblib
5
+
6
+ # Load the trained model
7
+ model = joblib.load("predictive_maintenance_model.pkl")
8
+
9
+ # Define the prediction function
10
+ def predict_maintenance(feature1, feature2, feature3, feature4):
11
+ input_data = np.array([[feature1, feature2, feature3, feature4]]) # Modify according to your dataset
12
+ prediction = model.predict(input_data)
13
+ return f"Predicted Maintenance Requirement: {prediction[0]}"
14
+
15
+ # Create the Gradio interface
16
+ interface = gr.Interface(
17
+ fn=predict_maintenance,
18
+ inputs=[
19
+ gr.Number(label="Feature 1"),
20
+ gr.Number(label="Feature 2"),
21
+ gr.Number(label="Feature 3"),
22
+ gr.Number(label="Feature 4"),
23
+ ],
24
+ outputs=gr.Textbox(label="Prediction"),
25
+ title="Predictive Maintenance for Industrial Equipment",
26
+ description="Enter sensor readings to predict maintenance requirements."
27
+ )
28
+
29
+ # Launch the app
30
+ interface.launch()