barentz96 commited on
Commit
90d20a8
1 Parent(s): 7cb422b

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +46 -0
  2. log_reg.pkl +3 -0
  3. svc.pkl +3 -0
app.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+ import pickle
5
+
6
+ # Load All Files
7
+ # Model Logistic Regresi
8
+ with open('log_reg.pkl', 'rb') as file_1:
9
+ model_log_reg = pickle.load(file_1)
10
+
11
+ # Model Suppor Vector Classifier
12
+ with open('svc.pkl', 'rb') as file_2:
13
+ model_svc = pickle.load(file_2)
14
+
15
+
16
+ st.subheader('Prediksi Kelas Pendapatan')
17
+
18
+ # Nilai dari education num
19
+ education_num = st.slider('Pilih Lama Waktu Pendidikan',3,16)
20
+
21
+ # Nilai dari fitur capital gain
22
+ capital_gain = st.slider('Masukkan Jumlah Capital Gain',0,100000)
23
+
24
+ # Nilai dari fitur hours per week
25
+ hours_per_week = st.number_input('Masukkan Total Waktu Kerja Per Minggu', 0, 80)
26
+
27
+ # value dari fitur new_occupation
28
+ occu = st.radio('Pilih Jenis Tingkat Pekerjaan',( 'Manager Up', 'Middle Worker', 'Low Worker', 'Others Service'))
29
+
30
+ # Value fitur sex
31
+ sex = st.radio('Pilih Jenis Kelamin',('Male', 'Female'))
32
+
33
+ if st.button('Predict'):
34
+ data_inf = pd.DataFrame({'education_num': education_num, 'capital_gain': capital_gain,
35
+ 'hours_per_week': hours_per_week, 'new_occupation': occu, 'sex':sex},index=[0])
36
+
37
+ hasil_log_reg = model_log_reg.predict(data_inf)[0]
38
+ st.write(f'Kelas Pendapatan Anda Menurut Model Logistic Regression: {hasil_log_reg}')
39
+
40
+ hasil_svm = model_svc.predict(data_inf)[0]
41
+ if hasil_svm == 0:
42
+ hasil_svm = '<=50K'
43
+ else:
44
+ hasil_svm = '>50K'
45
+ st.write(f'Kelas Pendapatan Anda Menurut Model Logistic SVC : {hasil_svm}')
46
+
log_reg.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d83bd276be3ff2035f33963121c8b3e7e13169ae81d5b088dc8b3ac56d569ae
3
+ size 3321
svc.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b91380b0840842f5636bccff7c7202ee21276cf8e4c37a8cc48200e76f0f5be3
3
+ size 255334