File size: 1,298 Bytes
cec404d
 
 
 
 
 
3a1ca90
627c1ba
cec404d
 
95f2d7f
 
cec404d
 
 
 
 
 
 
 
 
 
 
95f2d7f
 
 
 
 
 
 
 
 
 
cec404d
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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()