hidevscommunity commited on
Commit
cba2361
·
1 Parent(s): feab79c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +82 -0
app.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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('Click_through_prediction_RandomForest.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 = '46.png'
18
+ st.image(image, use_column_width=True)
19
+
20
+ st.subheader("Enter the following values:")
21
+
22
+ Daily_Time_Spent_on_Site = st.number_input("Daily Time Spent On Site")
23
+ Age = st.number_input("Age")
24
+ Daily_Internet_Usage = st.number_input("Daily Internet Usage")
25
+ Gender = st.selectbox("Gender",('Male','Female'))
26
+ if Gender == 'Male':
27
+ Gender = 0
28
+ else:
29
+ Gender = 1
30
+ Area_income = st.number_input("Area Income")
31
+
32
+
33
+
34
+ # Create a feature list from the user inputs
35
+ features = [[Daily_Time_Spent_on_Site,Age,Daily_Internet_Usage,Gender,Area_income]]
36
+
37
+ # Load the model
38
+ model = load_model()
39
+
40
+ # Make a prediction when the user clicks the "Predict" button
41
+ if st.button('Predict Rate'):
42
+ predicted_value = model_prediction(model, features)
43
+ st.success(f"Clicked on Ad: {predicted_value}")
44
+
45
+
46
+ def about_hidevs():
47
+
48
+ components.html("""
49
+ <div>
50
+ <h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
51
+ <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>
52
+ <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>
53
+ <p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
54
+ <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>
55
+ <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>
56
+ <p class="subtitle">💡 Join us now, and turbocharge your career!</p>
57
+ <p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
58
+ <a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
59
+ <a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
60
+ <a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
61
+ <a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
62
+ <a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
63
+ </div>
64
+ """,
65
+ height=600)
66
+
67
+ def main():
68
+
69
+ # Set the app title and add your website name and logo
70
+ st.set_page_config(
71
+ page_title="Clicked Through Rate Prediction",
72
+ page_icon=":chart_with_upwards_trend:",
73
+ )
74
+
75
+ st.title("Welcome to our Clicked Through Rate Prediction App!")
76
+
77
+ app_design()
78
+ st.header("About HiDevs Community")
79
+ about_hidevs()
80
+
81
+ if __name__ == '__main__':
82
+ main()