|
|
import gradio as gr |
|
|
import joblib |
|
|
import numpy as np |
|
|
|
|
|
|
|
|
model = joblib.load("best_svr_model.pkl") |
|
|
scaler = joblib.load("scaler.pkl") |
|
|
|
|
|
def predict_wear(load, particle_size, sliding_speed): |
|
|
input_data = np.array([[load, particle_size, sliding_speed]]) |
|
|
scaled_input = scaler.transform(input_data) |
|
|
prediction = model.predict(scaled_input) |
|
|
return round(prediction[0], 4) |
|
|
|
|
|
iface = gr.Interface( |
|
|
fn=predict_wear, |
|
|
inputs=[ |
|
|
gr.Number(label="Load (N)"), |
|
|
gr.Number(label="Particle Size (μm)"), |
|
|
gr.Number(label="Sliding Speed (mm/s)") |
|
|
], |
|
|
outputs=gr.Number(label="Predicted Volume Loss (mm³/s)"), |
|
|
title="Wear Performance Prediction", |
|
|
description="SVR Model to predict wear volume loss based on input parameters." |
|
|
) |
|
|
|
|
|
iface.launch() |