hidevscommunity
commited on
Commit
•
db38778
1
Parent(s):
e74d994
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pickle
|
4 |
+
import streamlit.components.v1 as components
|
5 |
+
|
6 |
+
# Load the pickled model
|
7 |
+
def load_model():
|
8 |
+
return pickle.load(open('Income_classification_ra.pkl', 'rb'))
|
9 |
+
|
10 |
+
# Function for model prediction
|
11 |
+
def model_prediction(model, features):
|
12 |
+
predicted = str(model.predict(features)[0])
|
13 |
+
return predicted
|
14 |
+
|
15 |
+
def app_design():
|
16 |
+
# Add input fields for High, Open, and Low values
|
17 |
+
image = '18.png'
|
18 |
+
st.image(image, use_column_width=True)
|
19 |
+
|
20 |
+
st.subheader("Enter the following values:")
|
21 |
+
|
22 |
+
Age = st.number_input("Age")
|
23 |
+
Workclass = st.number_input("Workclass")
|
24 |
+
Final_weight = st.number_input("Final_weight")
|
25 |
+
Education = st.number_input("Education")
|
26 |
+
Education_Num = st.number_input("Education_Num")
|
27 |
+
Marital_status = st.number_input("Marital_status")
|
28 |
+
Occupation = st.number_input("Occupation")
|
29 |
+
Relationship = st.number_input("Relationship")
|
30 |
+
Race = st.number_input("Race")
|
31 |
+
Sex = st.selectbox("Sex",('Male','Female'))
|
32 |
+
Capital_gain = st.number_input("Capital_gain")
|
33 |
+
Capital_loss = st.number_input("Capital_loss")
|
34 |
+
Hours_per_week = st.number_input("Hours_per_week")
|
35 |
+
Native_country = st.number_input("Native_country")
|
36 |
+
|
37 |
+
|
38 |
+
# Create a feature list from the user inputs
|
39 |
+
features = [[Age, Workclass, Final_weight, Education, Education_Num, Marital_status, Occupation,Relationship,Race,Sex,Capital_gain,Capital_loss,Hours_per_week,Native_country]]
|
40 |
+
|
41 |
+
# Load the model
|
42 |
+
model = load_model()
|
43 |
+
|
44 |
+
# Make a prediction when the user clicks the "Predict" button
|
45 |
+
if st.button('Predict Income'):
|
46 |
+
predicted_value = model_prediction(model, features)
|
47 |
+
if predicted_value=='1':
|
48 |
+
predicted_value='greater then 50000'
|
49 |
+
else:
|
50 |
+
predicted_value='less then or equal to 50000'
|
51 |
+
st.success(f"The Income is: {predicted_value}")
|
52 |
+
|
53 |
+
|
54 |
+
def about_hidevs():
|
55 |
+
|
56 |
+
components.html("""
|
57 |
+
<div>
|
58 |
+
<h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
|
59 |
+
<p class="subtitle">🔍 Seeking the perfect job? HiDevs Community is your gateway to career success in the tech industry. Explore free expert courses, job-seeking support, and career transformation tips.</p>
|
60 |
+
<p class="subtitle">💼 We offer an upskill program in <b>Gen AI, Data Science, Machine Learning</b>, and assist startups in adopting <b>Gen AI</b> at minimal development costs.</p>
|
61 |
+
<p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
|
62 |
+
<p class="subtitle">Book free of cost 1:1 mentorship on any topic of your choice — <a class="link" href="https://topmate.io/deepakchawla1307">topmate</a></p>
|
63 |
+
<p class="subtitle">✨ We dedicate over 30 minutes to each applicant’s resume, LinkedIn profile, mock interview, and upskill program. If you’d like our guidance, check out our services <a class="link" href="https://hidevscommunity.wixsite.com/hidevs">here</a></p>
|
64 |
+
<p class="subtitle">💡 Join us now, and turbocharge your career!</p>
|
65 |
+
<p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
|
66 |
+
<a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
|
67 |
+
<a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
|
68 |
+
<a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
|
69 |
+
<a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
|
70 |
+
<a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
|
71 |
+
</div>
|
72 |
+
""",
|
73 |
+
height=600)
|
74 |
+
|
75 |
+
def main():
|
76 |
+
|
77 |
+
# Set the app title and add your website name and logo
|
78 |
+
st.set_page_config(
|
79 |
+
page_title="Income Classification",
|
80 |
+
page_icon=":chart_with_upwards_trend:",
|
81 |
+
)
|
82 |
+
|
83 |
+
st.title("Welcome to our Income Classification App!")
|
84 |
+
|
85 |
+
app_design()
|
86 |
+
st.header("About HiDevs Community")
|
87 |
+
about_hidevs()
|
88 |
+
|
89 |
+
if __name__ == '__main__':
|
90 |
+
main()
|