File size: 811 Bytes
b36d3eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import joblib
import numpy as np

# Load saved model and scaler
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()