Snigs98's picture
Update app.py
627c1ba verified
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()