Kashi-Kumari's picture
Update app.py
7b1e2ad verified
Raw History Blame Contribute Delete
1.32 kB
import gradio as gr
import joblib
import numpy as np
# Load model
model = joblib.load("model.pkl")
scaler = joblib.load("scaler.pkl")
def predict(*inputs):
data = np.array(inputs).reshape(1, -1)
data = scaler.transform(data)
pred = model.predict(data)[0]
return "Defective" if pred == 1 else "Not Defective"
interface = gr.Interface(
fn=predict,
inputs=[
gr.Number(label="Maintenance Hours"),
gr.Number(label="Defect Rate"),
gr.Number(label="Quality Score"),
gr.Number(label="Production Volume"),
gr.Number(label="Additive Material Cost"),
gr.Number(label="Stockout Rate"),
gr.Number(label="Energy Efficiency"),
gr.Number(label="Inventory Turnover"),
gr.Number(label="Production Cost"),
gr.Number(label="Energy Consumption"),
gr.Number(label="Downtime Percentage"),
gr.Number(label="Supplier Quality"),
gr.Number(label="Additive Process Time"),
gr.Number(label="Worker Productivity"),
gr.Number(label="Safety Incidents"),
gr.Number(label="Delivery Delay"),
],
outputs="text",
title="Manufacturing Defect Prediction",
description="Enter production parameters to predict defect status"
)
interface.launch(server_name="0.0.0.0", server_port=7860)