winterForestStump
commited on
Commit
•
14cd217
1
Parent(s):
8c69533
Upload 3 files
Browse files- app.py +41 -0
- bank_marketing_pipe.skops +0 -0
- requirements .txt +2 -0
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import skops.io as sio
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
pipe = sio.load("bank_marketing_pipe.skops", trusted=True)
|
5 |
+
|
6 |
+
classes = [
|
7 |
+
"Not Subscribe",
|
8 |
+
"Subscribe"]
|
9 |
+
|
10 |
+
|
11 |
+
def classifier(age, job, marital, education, default, balance, housing,loan, contact):
|
12 |
+
pred = pipe.predict([[age, job, marital, education, default, balance, housing,loan, contact]])[0]
|
13 |
+
label = f"Predicted output: **{classes[pred]}**"
|
14 |
+
return label
|
15 |
+
|
16 |
+
|
17 |
+
inputs = [
|
18 |
+
gr.Slider(10, 90, step=1, label="Age"),
|
19 |
+
gr.Dropdown(["admin.","unknown","unemployed","management","housemaid","entrepreneur","student","blue-collar",
|
20 |
+
"self-employed","retired","technician","services"], label="Job", multiselect=False),
|
21 |
+
gr.Dropdown(["married","divorced","single"], label="Marital", multiselect=False),
|
22 |
+
gr.Dropdown(["unknown","secondary","primary","tertiary"], label="Education", multiselect=False),
|
23 |
+
gr.Radio(["yes","no"], label="Default", info='has credit in default?'),
|
24 |
+
gr.Slider(-100000, 100000, step=1, label="Balance"),
|
25 |
+
gr.Radio(["yes","no"], label="Housing", info='has housing loan?'),
|
26 |
+
gr.Radio(["yes","no"], label="Loan", info='has personal loan?'),
|
27 |
+
gr.Dropdown(["unknown","telephone","cellular"], label="Contact")
|
28 |
+
]
|
29 |
+
|
30 |
+
outputs = [gr.Label(num_top_classes=2)]
|
31 |
+
|
32 |
+
title = "Deposit Subscription Prediction"
|
33 |
+
description = "Enter the details to identify where or not the customer is subscribed or not subscribed for deposit"
|
34 |
+
|
35 |
+
gr.Interface(
|
36 |
+
fn=classifier,
|
37 |
+
inputs=inputs,
|
38 |
+
outputs=outputs,
|
39 |
+
title=title,
|
40 |
+
description=description,
|
41 |
+
).launch()
|
bank_marketing_pipe.skops
ADDED
Binary file (811 kB). View file
|
|
requirements .txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
skops==0.8.0
|
2 |
+
scikit-learn==1.2.2
|