File size: 3,063 Bytes
b778f4a
 
 
 
 
 
a8b342f
 
b778f4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92fc1da
 
 
b778f4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')

data = pd.read_csv("Placement_Data_Full_Class.csv")

X = data.drop(["sl_no","status","salary"],axis=1)
y = data["status"]

X = pd.get_dummies(X,drop_first=True)
y = pd.get_dummies(y,drop_first=True)

from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
X = scaler.fit_transform(X)

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1)

from sklearn.linear_model import LogisticRegression
model = LogisticRegression()

model.fit(X_train,y_train)

def prediction(name,gender,ssc_p,ssc_b,hsc_p,hsc_b,hsc_s,degree_p,degree_t,workex,etest_p,specialisation,mba_p):
    df = pd.DataFrame({"gender":gender,
                       "ssc_p":float(ssc_p),"ssc_b":ssc_b,"hsc_p":int(hsc_p),"hsc_b":hsc_b,"hsc_s":hsc_s,
                       "degree_p":float(degree_p),
                       "degree_t":degree_t,"workex":workex,"etest_p":float(etest_p),"specialisation":specialisation,
                       "mba_p":float(mba_p)
                       },index=[0])
    data = pd.read_csv("Placement_Data_Full_Class.csv")
    data = data.drop(["sl_no","status","salary"],axis=1)
    data = data.append(df,ignore_index = True)
    data = pd.get_dummies(data,drop_first = True)
    data = scaler.fit_transform(data)
    var = model.predict(data[[-1]])
    if var == 1:
        return "Congratulations! "+name+", you have a high chance of getting placed."
    else:
        return "Sorry! "+name+", better luck next time."
 
import gradio as gr
       
interface = gr.Interface(prediction,inputs=[
    gr.Textbox(lines=2, placeholder="Enter your Name Here...", show_label = False),
    gr.Dropdown(choices=["M","F"],value = "M",label = "Select your Gender"),
    gr.Textbox(lines=2, placeholder="Enter your SSC Percentage Here...", show_label = False),
    gr.Dropdown(choices=["Central","Others"],value = "Central",label = "Select your SSC Board"),
    gr.Textbox(lines=2, placeholder="Enter your HSC Percentage Here...",show_label  = False),
    gr.Dropdown(choices=["Central","Others"],value = "Others",label = "Select your HSC Board"),
    gr.Dropdown(choices=["Commerce","Science","Arts"],value = "Commerce",label = "Select your HSC Stream"),
    gr.Textbox(lines=2, placeholder="Enter your Degree Percentage Here...",show_label = False),
    gr.Dropdown(choices=["Comm&Mgmt","Sci&Tech","Others"],value = "Comm&Mgmt",label = "Select your Degree Domain"),
    gr.Dropdown(choices=["No","Yes"],value = "No",label = "Select Whether you have prior Work Experience"),
    gr.Textbox(lines=2, placeholder="Enter your E Test Percentage Here...",show_label = False),
    gr.Dropdown(choices=["Mkt&Fin","Mkt&HR"],value = "Mkt&Fin",label = "Select your Specialisation"),
    gr.Textbox(lines=2, placeholder="Enter your MBA Percentage Here...",show_label = False)
],outputs = gr.Label(value = "Prediction"),description = "Predicting Placement Chances")

interface.launch()