import gradio as gr import joblib # Save the trained model joblib.dump(clf, "decision_tree_iris.pkl") # Load iris dataset labels iris = load_iris() target_names = iris.target_names # Define prediction function def predict_species(sepal_length, sepal_width, petal_length, petal_width): model = joblib.load("decision_tree_iris.pkl") features = [[sepal_length, sepal_width, petal_length, petal_width]] prediction = model.predict(features)[0] return f"Predicted Species: {target_names[prediction]}" # Build Gradio UI interface = gr.Interface( fn=predict_species, inputs=[ gr.Number(label="Sepal Length"), gr.Number(label="Sepal Width"), gr.Number(label="Petal Length"), gr.Number(label="Petal Width") ], outputs="text", title="Decision Tree Classifier - Iris Dataset 🌸", description="Enter flower measurements and let the Decision Tree predict the species." ) interface.launch() __ __