| | import gradio as gr |
| | import joblib |
| |
|
| | |
| | model = joblib.load('salary_prediction_model.joblib') |
| |
|
| | |
| | def predict_salary(age, gender, education, job_title, years_experience, country, race): |
| | |
| | input_data = [[age, gender, education, job_title, years_experience, country, race]] |
| | |
| | prediction = model.predict(input_data) |
| | return prediction[0] |
| |
|
| | |
| | iface = gr.Interface( |
| | fn=predict_salary, |
| | inputs=[ |
| | gr.inputs.Number(label="Age"), |
| | gr.inputs.Dropdown(choices=["Male", "Female"], label="Gender"), |
| | gr.inputs.Dropdown(choices=["Bachelor's", "Master's", "PhD"], label="Education Level"), |
| | gr.inputs.Textbox(label="Job Title"), |
| | gr.inputs.Number(label="Years of Experience"), |
| | gr.inputs.Dropdown(choices=["USA", "UK", "Canada"], label="Country"), |
| | gr.inputs.Dropdown(choices=["White", "Hispanic", "Asian"], label="Race") |
| | ], |
| | outputs="number", |
| | title="Salary Prediction Model", |
| | description="Predict salary based on various factors." |
| | ) |
| |
|
| | |
| | iface.launch() |
| |
|