Create app.py
Browse files
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 |
+
|
| 6 |
+
# Load the pickled model
|
| 7 |
+
def load_model():
|
| 8 |
+
return pickle.load(open('Mobile_Price_Prediction_LogisticRegression.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 = '53.png'
|
| 18 |
+
st.image(image, use_column_width=True)
|
| 19 |
+
|
| 20 |
+
st.subheader("Enter the following values:")
|
| 21 |
+
|
| 22 |
+
battery_power = st.number_input("Battery Power")
|
| 23 |
+
blue = st.number_input("Blue")
|
| 24 |
+
clock_speed = st.number_input("Clock Speed")
|
| 25 |
+
dual_sim = st.number_input("Dual Sim")
|
| 26 |
+
fc = st.number_input("fc")
|
| 27 |
+
four_g = st.number_input("4G")
|
| 28 |
+
int_memory = st.number_input("Int Memory")
|
| 29 |
+
m_dep = st.number_input("M Dep")
|
| 30 |
+
mobile_wt = st.number_input("Mobile Weight")
|
| 31 |
+
n_cores = st.number_input("No. of Cores")
|
| 32 |
+
pc = st.number_input("PC")
|
| 33 |
+
px_height = st.number_input("PX Height")
|
| 34 |
+
px_width = st.number_input("PX Width")
|
| 35 |
+
ram = st.number_input("RAM")
|
| 36 |
+
sc_h = st.number_input("SC Height")
|
| 37 |
+
sc_w = st.number_input("SC weight")
|
| 38 |
+
talk_time = st.number_input("Talk Time")
|
| 39 |
+
three_g = st.number_input("3G")
|
| 40 |
+
touch_screen = st.number_input("Touch Screen")
|
| 41 |
+
wifi = st.number_input("Wifi")
|
| 42 |
+
|
| 43 |
+
# Create a feature list from the user inputs
|
| 44 |
+
features = [[battery_power,blue,clock_speed,dual_sim,fc,four_g,int_memory,m_dep,mobile_wt,n_cores,pc,px_height,px_width,ram,sc_h,sc_w,talk_time,three_g,touch_screen,wifi]]
|
| 45 |
+
|
| 46 |
+
# Load the model
|
| 47 |
+
model = load_model()
|
| 48 |
+
|
| 49 |
+
# Make a prediction when the user clicks the "Predict" button
|
| 50 |
+
if st.button('Predict Model'):
|
| 51 |
+
predicted_value = model_prediction(model, features)
|
| 52 |
+
if predicted_value=='0':
|
| 53 |
+
st.success('The Mobile Price is Low')
|
| 54 |
+
elif predicted_value=='1':
|
| 55 |
+
st.success('The Mobile Price is Medium')
|
| 56 |
+
elif predicted_value=='2':
|
| 57 |
+
st.success('The Mobile Price is High')
|
| 58 |
+
else:
|
| 59 |
+
st.success('The Mobile Price is Very High')
|
| 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="Mobile Price Classification",
|
| 88 |
+
page_icon=":chart_with_upwards_trend:",
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
st.title("Welcome to our Mobile Price Classification App!")
|
| 92 |
+
|
| 93 |
+
app_design()
|
| 94 |
+
st.header("About HiDevs Community")
|
| 95 |
+
about_hidevs()
|
| 96 |
+
|
| 97 |
+
if __name__ == '__main__':
|
| 98 |
+
main()
|