Files changed (1) hide show
  1. app.py +20 -61
app.py CHANGED
@@ -7,7 +7,7 @@ le = LabelEncoder()
7
 
8
  # Load the pickled model
9
  def load_model():
10
- return pickle.load(open('Income_classification_ra.pkl', 'rb'))
11
 
12
  # Function for model prediction
13
  def model_prediction(model, features):
@@ -20,88 +20,47 @@ def transform(text):
20
 
21
  def app_design():
22
  # Add input fields for High, Open, and Low values
23
- image = '18.png'
24
  st.image(image, use_column_width=True)
25
 
26
  st.subheader("Enter the following values:")
27
 
28
- Age = st.number_input("Age")
29
- Workclass = st.text_input("Workclass")
30
- Workclass = transform([Workclass])
31
- Final_weight = st.number_input("Final_weight")
32
- Education = st.text_input("Education")
33
- Education=transform([Education])
34
- Education_Num = st.number_input("Education_Num")
35
- Marital_status = st.text_input("Marital_status")
36
- Marital_status=transform([Marital_status])
37
- Occupation = st.text_input("Occupation")
38
- Occupation=transform([Occupation])
39
- Relationship = st.text_input("Relationship")
40
- Relationship=transform([Relationship])
41
- Race = st.text_input("Race")
42
- Race=transform([Race])
43
- Sex = st.selectbox("Sex",('Male','Female'))
44
- if Sex == 'Male':
45
- Sex = 1
46
- else:
47
- Sex = 0
48
- Capital_gain = st.number_input("Capital_gain")
49
- Capital_loss = st.number_input("Capital_loss")
50
- Hours_per_week = st.number_input("Hours_per_week")
51
- Native_country = st.text_input("Native_country")
52
- Native_country=transform([Native_country])
53
-
54
 
55
  # Create a feature list from the user inputs
56
- features = [[Age, Workclass, Final_weight, Education, Education_Num, Marital_status, Occupation,Relationship,Race,Sex,Capital_gain,Capital_loss,Hours_per_week,Native_country]]
57
 
58
  # Load the model
59
  model = load_model()
60
 
61
  # Make a prediction when the user clicks the "Predict" button
62
- if st.button('Predict Income'):
63
  predicted_value = model_prediction(model, features)
64
- if predicted_value=='1':
65
- predicted_value='greater then 50000'
66
- else:
67
- predicted_value='less then or equal to 50000'
68
- st.success(f"The Income is: {predicted_value}")
69
-
70
 
71
- def about_hidevs():
72
 
73
- components.html("""
74
- <div>
75
- <h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
76
- <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>
77
- <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>
78
- <p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
79
- <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>
80
- <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>
81
- <p class="subtitle">💡 Join us now, and turbocharge your career!</p>
82
- <p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
83
- <a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
84
- <a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
85
- <a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
86
- <a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
87
- <a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
88
- </div>
89
- """,
90
- height=600)
91
 
92
  def main():
93
 
94
  # Set the app title and add your website name and logo
95
  st.set_page_config(
96
- page_title="Income Classification",
97
  page_icon=":chart_with_upwards_trend:",
98
  )
99
 
100
- st.title("Welcome to our Income Classification App!")
101
 
102
- app_design()
103
- st.header("About HiDevs Community")
104
- about_hidevs()
105
 
106
  if __name__ == '__main__':
107
- main()
 
7
 
8
  # Load the pickled model
9
  def load_model():
10
+ return pickle.load(open('Diamond_Price_Prediction_LinearRegression.pkl', 'rb'))
11
 
12
  # Function for model prediction
13
  def model_prediction(model, features):
 
20
 
21
  def app_design():
22
  # Add input fields for High, Open, and Low values
23
+ image = ''
24
  st.image(image, use_column_width=True)
25
 
26
  st.subheader("Enter the following values:")
27
 
28
+ Carat = st.number_input("Carat(Weight of Daimond)")
29
+ Cut = st.text_input("Cut(Quality) ('Ideal','Premium','Good','Very Good','Fair')")
30
+ Cut = transform([Cut])
31
+ Color = st.text_input("Color ('E','I','J','H','F','G','D')")
32
+ Color=transform([Color])
33
+ Clarity = st.text_input("Clarity ('SI2','SI1','VS1','VS2','VVS2','VVS1','I1','IF')")
34
+ Clarity=transform([Clarity])
35
+ Depth = st.number_input("Depth")
36
+ Table = st.number_input("Table")
37
+ X_length = st.number_input("X length")
38
+ Y_width = st.number_input("Y width")
39
+ Z_depth = st.number_input("Z depth")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  # Create a feature list from the user inputs
42
+ features = [[Carat,Cut,Color,Clarity,Depth,Table,X_length,Y_width,Z_depth]]
43
 
44
  # Load the model
45
  model = load_model()
46
 
47
  # Make a prediction when the user clicks the "Predict" button
48
+ if st.button('Predict Price'):
49
  predicted_value = model_prediction(model, features)
50
+ st.success(f"The Price is: {predicted_value}")
 
 
 
 
 
51
 
 
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  def main():
55
 
56
  # Set the app title and add your website name and logo
57
  st.set_page_config(
58
+ page_title="Diamond Price Prediction",
59
  page_icon=":chart_with_upwards_trend:",
60
  )
61
 
62
+ st.title("Welcome to our Diamond Price Prediction App!")
63
 
 
 
 
64
 
65
  if __name__ == '__main__':
66
+ main()