hidevscommunity commited on
Commit
9c1ae3d
·
verified ·
1 Parent(s): 09ede97

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -0
app.py ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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('Stock_Prediction_li.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 = '42.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
+ Rank = st.number_input("Rank")
30
+
31
+ Platform = st.text_input("Platform")
32
+ Platform = transform([Platform])
33
+
34
+ Year = st.number_input("Year")
35
+
36
+ Genre = st.text_input("Genre")
37
+ Genre = transform([Genre])
38
+
39
+ Publisher = st.text_input("Publisher")
40
+ Publisher = transform([Publisher])
41
+
42
+ NA_Sales_up = st.number_input("NA Sales Up")
43
+
44
+ EU_Sales_up = st.number_input("EU Sales Up")
45
+
46
+ JP_Sales_up = st.number_input("JP Sales Up")
47
+
48
+ Other_Sales_up = st.number_input("Other Sales Up")
49
+
50
+ # Create a feature list from the user inputs
51
+ features = [[Rank, Platform, Year, Genre, Publisher, NA_Sales_up, EU_Sales_up, JP_Sales_up, Other_Sales_up]]
52
+
53
+ # Load the model
54
+ model = load_model()
55
+
56
+ # Make a prediction when the user clicks the "Predict" button
57
+ if st.button('Predict Sale'):
58
+ predicted_value = model_prediction(model, features)
59
+ st.success(f"The Sale is: {predicted_value}")
60
+
61
+
62
+ def about_hidevs():
63
+
64
+ components.html("""
65
+ <div>
66
+ <h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
67
+ <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>
68
+ <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>
69
+ <p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
70
+ <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>
71
+ <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>
72
+ <p class="subtitle">💡 Join us now, and turbocharge your career!</p>
73
+ <p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
74
+ <a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
75
+ <a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
76
+ <a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
77
+ <a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
78
+ <a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
79
+ </div>
80
+ """,
81
+ height=600)
82
+
83
+ def main():
84
+
85
+ # Set the app title and add your website name and logo
86
+ st.set_page_config(
87
+ page_title="Video Game Sales Prediction",
88
+ page_icon=":chart_with_upwards_trend:",
89
+ )
90
+
91
+ st.title("Welcome to our Video Game Sales Prediction Prediction App!")
92
+
93
+ app_design()
94
+ st.header("About HiDevs Community")
95
+ about_hidevs()
96
+
97
+ if __name__ == '__main__':
98
+ main()