Snigs98's picture
Create app1.py
c34b0ba verified
raw
history blame
946 Bytes
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):
input_data = np.array([[feature1, feature2, feature3, feature4]]) # 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"),
],
outputs=gr.Textbox(label="Prediction"),
title="Predictive Maintenance for Industrial Equipment",
description="Enter sensor readings to predict maintenance requirements."
)
# Launch the app
interface.launch()