import gradio as gr import joblib import numpy as np import sklearn 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, 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." ) # Launch the interface iface.launch()