hidevscommunity commited on
Commit
72efbb6
·
verified ·
1 Parent(s): ece3bfe

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +96 -0
app.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as np
3
+ import pickle
4
+ import streamlit.components.v1 as components
5
+ from sklearn.preprocessing import LabelEncoder
6
+ le = LabelEncoder()
7
+ # Load the pickled model
8
+ def load_model():
9
+ return pickle.load(open('Insurance_Prediction_kn.pkl', 'rb'))
10
+
11
+ # Function for model prediction
12
+ def model_prediction(model, features):
13
+ predicted = str(model.predict(features)[0])
14
+ return predicted
15
+
16
+ def transform(text):
17
+ text = le.fit_transform(text)
18
+ return text[0]
19
+
20
+ def app_design():
21
+ # Add input fields for High, Open, and Low values
22
+ image = '20.png'
23
+ st.image(image, use_column_width=True)
24
+
25
+ st.subheader("Enter the following values:")
26
+
27
+ #Encoding categorical data values
28
+
29
+ Age = st.number_input("Age")
30
+
31
+ EmploymentType = st.text_input("Employment Type")
32
+ EmploymentType = transform([EmploymentType])
33
+
34
+ GraduateOrNot = st.number_input("Graduate Or Not")
35
+
36
+ AnnualIncome = st.number_input("Annual Income")
37
+
38
+
39
+ FamilyMembers = st.number_input("Family Members")
40
+
41
+ FrequentFlyer = st.number_input("Frequent Flyer")
42
+
43
+ EverTravelledAbroad = st.number_input("Ever Travelled Abroad")
44
+
45
+ # Create a feature list from the user inputs
46
+ features = [[Age, EmploymentType, GraduateOrNot, AnnualIncome, FamilyMembers, FrequentFlyer, EverTravelledAbroad]]
47
+
48
+ # Load the model
49
+ model = load_model()
50
+
51
+ # Make a prediction when the user clicks the "Predict" button
52
+ if st.button('Predict Price'):
53
+ predicted_value = model_prediction(model, features)
54
+ if "-" in predicted_value:
55
+ st.success("The Car Price is: 0")
56
+ else:
57
+ st.success(f"The Car Price is: {predicted_value}")
58
+
59
+
60
+ def about_hidevs():
61
+
62
+ components.html("""
63
+ <div>
64
+ <h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
65
+ <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>
66
+ <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>
67
+ <p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
68
+ <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>
69
+ <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>
70
+ <p class="subtitle">💡 Join us now, and turbocharge your career!</p>
71
+ <p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
72
+ <a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
73
+ <a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
74
+ <a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
75
+ <a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
76
+ <a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
77
+ </div>
78
+ """,
79
+ height=600)
80
+
81
+ def main():
82
+
83
+ # Set the app title and add your website name and logo
84
+ st.set_page_config(
85
+ page_title="Car Price Prediction",
86
+ page_icon=":chart_with_upwards_trend:",
87
+ )
88
+
89
+ st.title("Welcome to our Car Price Prediction App!")
90
+
91
+ app_design()
92
+ st.header("About HiDevs Community")
93
+ about_hidevs()
94
+
95
+ if __name__ == '__main__':
96
+ main()