import gradio as gr import joblib # Load your saved model # model = joblib.load("ann_model.joblib") # # Define the prediction function def predict(age, hours, education, capital_gain, capital_loss): # features = [[age, hours, education, capital_gain, capital_loss]] # prediction = model.predict(features) prediction = 1 return "Income >50K" if prediction == 1 else "Income <=50K" # Create the Gradio interface interface = gr.Interface( fn=predict, inputs=[ gr.Slider(18, 90, step=1, label="Age"), gr.Slider(1, 99, step=1, label="Hours Per Week"), gr.Slider(1, 20, step=1, label="Education Level (Years)"), gr.Slider(0, 100000, step=100, label="Capital Gain"), gr.Slider(0, 5000, step=50, label="Capital Loss"), ], outputs="text", title="Adult Income Predictor", ) # Launch the app interface.launch()