AsthanM commited on
Commit
5c82c00
·
verified ·
1 Parent(s): 535dc3c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import joblib
3
+ import pandas as pd
4
+
5
+ # Load the trained model and label encoder
6
+ model = joblib.load("employability_model.pkl")
7
+ label_encoder = joblib.load("label_encoder.pkl")
8
+
9
+ # Define feature names based on the dataset
10
+ FEATURES = [
11
+ "GENERAL APPEARANCE", "MANNER OF SPEAKING", "PHYSICAL CONDITION", "MENTAL ALERTNESS",
12
+ "SELF-CONFIDENCE", "ABILITY TO PRESENT IDEAS", "COMMUNICATION SKILLS", "Student Performance Rating"
13
+ ]
14
+
15
+ def predict_employability(*inputs):
16
+ # Convert inputs into DataFrame
17
+ user_df = pd.DataFrame([inputs], columns=FEATURES)
18
+
19
+ # Make prediction
20
+ prediction = model.predict(user_df)[0]
21
+ result = "✅ Employable" if prediction == 1 else "😞 Less Employable"
22
+ return result
23
+
24
+ # Create the Gradio interface
25
+ iface = gr.Interface(
26
+ fn=predict_employability,
27
+ inputs=[gr.Slider(1, 5, step=1, label=feature) for feature in FEATURES],
28
+ outputs="text",
29
+ title="Employability Prediction",
30
+ description="Rate yourself on the following attributes (1-5) to check if you're employable!"
31
+ )
32
+
33
+ # Launch the app
34
+ if __name__ == "__main__":
35
+ iface.launch()