Feiiisal commited on
Commit
c6e9cf0
·
1 Parent(s): 21c1b03
app.py CHANGED
@@ -4,15 +4,15 @@ import pickle
4
  import os
5
 
6
  # Load the model and encoder
7
- SIC = os.path.abspath('.')
8
- pipeline_path = os.path.join(SIC, 'rfc_pipeline.pkl')
9
- encoder_path = os.path.join(SIC, 'encoder.pkl')
10
 
11
  with open(pipeline_path, 'rb') as file:
12
- model = pickle.load(file)
13
 
14
- with open(encoder_path, 'rb') as file:
15
- encoder = pickle.load(file)
16
 
17
  # Sidebar for navigation
18
  st.sidebar.title("Navigation")
@@ -98,9 +98,12 @@ if options == "Prediction":
98
  'citizenship', 'importance_of_record'
99
  ])
100
 
 
 
 
101
  # Predict and display results
102
- prediction = model.predict(input_data)
103
- probability = model.predict_proba(input_data).max(axis=1)[0]
104
  result = "Above Limit" if prediction[0] == 1 else "Below Limit"
105
  st.success(f'Income Level Prediction: {result}')
106
  st.info(f'Prediction Probability: {probability:.2f}')
@@ -119,8 +122,8 @@ elif options == "Model Information":
119
  - **Training Data:**
120
  - Our model is trained on comprehensive census data, encompassing a wide range of features such as age, education, marital status, race, occupation, and more. This rich dataset ensures a nuanced understanding of the socio-economic factors influencing income levels.
121
 
122
- - **Accuracy:** 92%
123
- - With an accuracy of 92%, our model stands as a reliable predictor, demonstrating its effectiveness in understanding and categorizing income levels.
124
 
125
  - **What It Aims to Solve:**
126
  - **Economic Research:** Assists in socio-economic studies, understanding income distribution, and identifying key factors influencing income levels.
@@ -135,7 +138,6 @@ elif options == "Model Information":
135
 
136
 
137
  # Feedback Page
138
-
139
  elif options == "Feedback":
140
  st.title("Feedback")
141
  st.write("We value your feedback! Please let us know your thoughts about the model and interface.")
 
4
  import os
5
 
6
  # Load the model and encoder
7
+ SRC = os.path.abspath('.')
8
+ pipeline_path = os.path.join(SRC, 'pipeline.pkl')
9
+ model_path = os.path.join(SRC, 'rfc_model.pkl')
10
 
11
  with open(pipeline_path, 'rb') as file:
12
+ pipeline = pickle.load(file)
13
 
14
+ with open(model_path, 'rb') as file:
15
+ model = pickle.load(file)
16
 
17
  # Sidebar for navigation
18
  st.sidebar.title("Navigation")
 
98
  'citizenship', 'importance_of_record'
99
  ])
100
 
101
+ # Preprocess the input data through the pipeline before making predictions
102
+ input_data_transformed = pipeline.transform(input_data)
103
+
104
  # Predict and display results
105
+ prediction = model.predict(input_data_transformed)
106
+ probability = model.predict_proba(input_data_transformed).max(axis=1)[0]
107
  result = "Above Limit" if prediction[0] == 1 else "Below Limit"
108
  st.success(f'Income Level Prediction: {result}')
109
  st.info(f'Prediction Probability: {probability:.2f}')
 
122
  - **Training Data:**
123
  - Our model is trained on comprehensive census data, encompassing a wide range of features such as age, education, marital status, race, occupation, and more. This rich dataset ensures a nuanced understanding of the socio-economic factors influencing income levels.
124
 
125
+ - **Accuracy:** 94%
126
+ - With an accuracy of 94%, our model stands as a reliable predictor, demonstrating its effectiveness in understanding and categorizing income levels.
127
 
128
  - **What It Aims to Solve:**
129
  - **Economic Research:** Assists in socio-economic studies, understanding income distribution, and identifying key factors influencing income levels.
 
138
 
139
 
140
  # Feedback Page
 
141
  elif options == "Feedback":
142
  st.title("Feedback")
143
  st.write("We value your feedback! Please let us know your thoughts about the model and interface.")
encoder.pkl → pipeline.pkl RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:98baac762b1becb7d5b699f21576a27ebe7555a83826444f23d540dcfc7d01d1
3
- size 270
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd28c23cc70beba35906a28c1b6937630ffb3bb4a7c5e8cb8276f66a33eb60e4
3
+ size 4811
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
- streamlit
2
- pandas
3
- scikit-learn==1.3.0
 
1
+ streamlit==1.29.0
2
+ pandas==2.1.4
3
+ scikit-learn==1.3.2
rfc_pipeline.pkl → rfc_model.pkl RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:de6be7713061b3b93f04b7e4c3239216dc6f51b4b18ead0b60fce19c0cbe594e
3
- size 223631035
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd6ad029aa941d54353a585b399b77c15380a06cfa80a2c81faf9697effe0aac
3
+ size 267723561