Spaces:
Sleeping
Sleeping
Commit
·
ae1a672
1
Parent(s):
8b9d0c0
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
+
import warnings
|
| 5 |
+
warnings.filterwarnings('ignore')
|
| 6 |
+
|
| 7 |
+
data = pd.read_csv("Placement_Data_Full_Class.csv")
|
| 8 |
+
|
| 9 |
+
X = data.drop(["sl_no","status","salary"],axis=1)
|
| 10 |
+
y = data["status"]
|
| 11 |
+
|
| 12 |
+
X = pd.get_dummies(X,drop_first=True)
|
| 13 |
+
y = pd.get_dummies(y,drop_first=True)
|
| 14 |
+
|
| 15 |
+
from sklearn.preprocessing import MinMaxScaler
|
| 16 |
+
scaler = MinMaxScaler()
|
| 17 |
+
X = scaler.fit_transform(X)
|
| 18 |
+
|
| 19 |
+
from sklearn.model_selection import train_test_split
|
| 20 |
+
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1)
|
| 21 |
+
|
| 22 |
+
from sklearn.linear_model import LogisticRegression
|
| 23 |
+
model = LogisticRegression()
|
| 24 |
+
|
| 25 |
+
model.fit(X_train,y_train)
|
| 26 |
+
|
| 27 |
+
def prediction(name,gender,ssc_p,ssc_b,hsc_p,hsc_b,hsc_s,degree_p,degree_t,workex,etest_p,specialisation,mba_p):
|
| 28 |
+
df = pd.DataFrame({"gender":gender,
|
| 29 |
+
"ssc_p":float(ssc_p),"ssc_b":ssc_b,"hsc_p":int(hsc_p),"hsc_b":hsc_b,"hsc_s":hsc_s,
|
| 30 |
+
"degree_p":float(degree_p),
|
| 31 |
+
"degree_t":degree_t,"workex":workex,"etest_p":float(etest_p),"specialisation":specialisation,
|
| 32 |
+
"mba_p":float(mba_p)
|
| 33 |
+
},index=[0])
|
| 34 |
+
data = pd.read_csv("Placement_Data_Full_Class.csv")
|
| 35 |
+
data = data.drop(["sl_no","status","salary"],axis=1)
|
| 36 |
+
data = data.append(df,ignore_index = True)
|
| 37 |
+
data = pd.get_dummies(data,drop_first = True)
|
| 38 |
+
data = scaler.fit_transform(data)
|
| 39 |
+
var = model.predict(data[[-1]])
|
| 40 |
+
if var == 1:
|
| 41 |
+
return "Congratulations! "+name+", you have a high chance of getting placed."
|
| 42 |
+
else:
|
| 43 |
+
return "Sorry! "+name+", better luck next time."
|
| 44 |
+
|
| 45 |
+
import gradio as gr
|
| 46 |
+
|
| 47 |
+
interface = gr.Interface(prediction,inputs=[
|
| 48 |
+
gr.Textbox(lines=2, placeholder="Enter your Name Here...", show_label = False),
|
| 49 |
+
gr.Dropdown(choices=["M","F"],value = "M",label = "Select your Gender"),
|
| 50 |
+
gr.Textbox(lines=2, placeholder="Enter your SSC Percentage Here...", show_label = False),
|
| 51 |
+
gr.Dropdown(choices=["Central","Others"],value = "Central",label = "Select your SSC Board"),
|
| 52 |
+
gr.Textbox(lines=2, placeholder="Enter your HSC Percentage Here...",show_label = False),
|
| 53 |
+
gr.Dropdown(choices=["Central","Others"],value = "Others",label = "Select your HSC Board"),
|
| 54 |
+
gr.Dropdown(choices=["Commerce","Science","Arts"],value = "Commerce",label = "Select your HSC Stream"),
|
| 55 |
+
gr.Textbox(lines=2, placeholder="Enter your Degree Percentage Here...",show_label = False),
|
| 56 |
+
gr.Dropdown(choices=["Comm&Mgmt","Sci&Tech","Others"],value = "Comm&Mgmt",label = "Select your Degree Domain"),
|
| 57 |
+
gr.Dropdown(choices=["No","Yes"],value = "No",label = "Select Whether you have prior Work Experience"),
|
| 58 |
+
gr.Textbox(lines=2, placeholder="Enter your E Test Percentage Here...",show_label = False),
|
| 59 |
+
gr.Dropdown(choices=["Mkt&Fin","Mkt&HR"],value = "Mkt&Fin",label = "Select your Specialisation"),
|
| 60 |
+
gr.Textbox(lines=2, placeholder="Enter your MBA Percentage Here...",show_label = False)
|
| 61 |
+
],outputs = gr.Label(value = "Prediction"),description = "Predicting Placement Chances")
|
| 62 |
+
|
| 63 |
+
interface.launch()
|