|
import gradio as gr |
|
import joblib |
|
import numpy as np |
|
import sklearn |
|
|
|
|
|
model = joblib.load('random_forest_model.pkl') |
|
|
|
|
|
def classify(*features): |
|
|
|
features_array = np.array([features]) |
|
|
|
prediction = model.predict(features_array) |
|
return f"Predicted Age Category: {prediction[0]}" |
|
|
|
|
|
iface = gr.Interface( |
|
fn=classify, |
|
inputs=[ |
|
gr.Slider(minimum=0, maximum=100, value=50, label=f"Feature {i+1}") for i in range(15) |
|
], |
|
outputs="text", |
|
title="Age Classification", |
|
description="Enter the 15 features to classify the age category." |
|
) |
|
|
|
|
|
iface.launch() |
|
|
|
|