Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- app.py +56 -0
- le_col.pkl +3 -0
- model.pkl +3 -0
- requirements.txt +4 -0
- std_column.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import joblib
|
| 4 |
+
|
| 5 |
+
le=joblib.load('le_col.pkl')
|
| 6 |
+
std=joblib.load('std_column.pkl')
|
| 7 |
+
model=joblib.load('model.pkl')
|
| 8 |
+
|
| 9 |
+
le_col=['Gender','Geography','CardType']
|
| 10 |
+
std_column=['Tenure','SatisfactionScore','CreditScore','Age','PointEarned','EstimatedSalary']
|
| 11 |
+
|
| 12 |
+
def prediction_Bank_model(creditScore,geography,gender,age,tenure,hasCrCard,estimatedSalary,complain,satisfactionScore,cardType,pointEarned):
|
| 13 |
+
try:
|
| 14 |
+
input_data=pd.DataFrame({
|
| 15 |
+
'CreditScore':[creditScore],
|
| 16 |
+
'Geography':[geography],
|
| 17 |
+
'Gender':[gender],
|
| 18 |
+
'Age':[age],
|
| 19 |
+
'Tenure':[tenure],
|
| 20 |
+
'HasCrCard':[hasCrCard],
|
| 21 |
+
'EstimatedSalary':[estimatedSalary],
|
| 22 |
+
'Complain':[complain],
|
| 23 |
+
'SatisfactionScore':[satisfactionScore],
|
| 24 |
+
'CardType':[cardType],
|
| 25 |
+
'PointEarned':[pointEarned]
|
| 26 |
+
})
|
| 27 |
+
for col in le_col:
|
| 28 |
+
input_data[col]=le[col].transform(input_data[col])
|
| 29 |
+
input_data[std_column]=std.transform(input_data[std_column])
|
| 30 |
+
predictiction=model.predict(input_data)
|
| 31 |
+
if predictiction[0]==0:
|
| 32 |
+
return 'No'
|
| 33 |
+
else:
|
| 34 |
+
return 'yes'
|
| 35 |
+
except Exception as e:
|
| 36 |
+
return f"Error :{e}"
|
| 37 |
+
|
| 38 |
+
gr.Interface(
|
| 39 |
+
fn=prediction_Bank_model,
|
| 40 |
+
inputs=[
|
| 41 |
+
gr.Number(label='CreditScore'),
|
| 42 |
+
gr.Dropdown(choices=('France','Germany','Spain'),label='Geography'),
|
| 43 |
+
gr.Dropdown(choices=('Male','Female'),label='Gender'),
|
| 44 |
+
gr.Number(label='Age'),
|
| 45 |
+
gr.Number(label='Tenure'),
|
| 46 |
+
gr.Number(label='HasCrCard'),
|
| 47 |
+
gr.Number(label='EstimatedSalary'),
|
| 48 |
+
gr.Number(label='Complain'),
|
| 49 |
+
gr.Number(label='SatisfactionScore'),
|
| 50 |
+
gr.Dropdown(choices=('DIAMOND','GOLD','SILVER','PLATINUM'),label='CardType'),
|
| 51 |
+
gr.Number(label='PointEarned')
|
| 52 |
+
|
| 53 |
+
],
|
| 54 |
+
outputs=gr.Textbox(label='Prediction'),
|
| 55 |
+
title='Prediction Program'
|
| 56 |
+
).launch()
|
le_col.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:02079d20352f5bbd7ddf8933f115d9f391afddf3a47a6506f2e52ec0be4b9f2f
|
| 3 |
+
size 1178
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a91c3cdce5a775c1c37d0234e66b4b4256e656d951cdb4274e38cff68e9ffeb0
|
| 3 |
+
size 1439
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
pandas
|
| 3 |
+
joblib
|
| 4 |
+
scikit-learn
|
std_column.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ca469341fbbdecc0b121932ea6dbbe27cd06b9b34f4681fef735f88c1dda098
|
| 3 |
+
size 1159
|