kedimestan's picture
Create app.py
8c975b7 verified
raw
history blame
795 Bytes
import gradio as gr
import joblib
import numpy as np
# Load the RandomForest model
model = joblib.load('random_forest_model.pkl') # Update with the actual path
# Define a function for classification
def classify(features):
# Convert the input features to a 2D numpy array
features_array = np.array([features])
# Make a prediction
prediction = model.predict(features_array)
return f"Predicted Age Category: {prediction[0]}"
# Create the Gradio interface
iface = gr.Interface(
fn=classify,
inputs=[
gr.Slider(minimum=0, maximum=100, default=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."
)
# Launch the interface
iface.launch()