Spaces:
Build error
Build error
| import streamlit as st | |
| import numpy as np | |
| import pickle | |
| import streamlit.components.v1 as components | |
| # Load the pickled model | |
| def load_model(): | |
| return pickle.load(open('Mobile_Price_Prediction_LogisticRegression.pkl', 'rb')) | |
| # Function for model prediction | |
| def model_prediction(model, features): | |
| predicted = str(model.predict(features)[0]) | |
| return predicted | |
| def app_design(): | |
| # Add input fields for High, Open, and Low values | |
| image = '53.png' | |
| st.image(image, use_column_width=True) | |
| st.subheader("Enter the following values:") | |
| battery_power = st.number_input("Battery Power") | |
| blue = st.number_input("Bluetooth") | |
| clock_speed = st.number_input("Clock Speed") | |
| dual_sim = st.number_input("Dual Sim") | |
| fc = st.number_input("front camera") | |
| four_g = st.number_input("4G") | |
| int_memory = st.number_input("Int Memory") | |
| m_dep = st.number_input("Mobile Dep") | |
| mobile_wt = st.number_input("Mobile Weight") | |
| n_cores = st.number_input("No. of Cores") | |
| pc = st.number_input("Primary camera") | |
| px_height = st.number_input("PX Height") | |
| px_width = st.number_input("PX Width") | |
| ram = st.number_input("RAM") | |
| sc_h = st.number_input("SC Height") | |
| sc_w = st.number_input("SC width") | |
| talk_time = st.number_input("Talk Time") | |
| three_g = st.number_input("3G") | |
| touch_screen = st.number_input("Touch Screen") | |
| wifi = st.number_input("Wifi") | |
| # Create a feature list from the user inputs | |
| 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]] | |
| # Load the model | |
| model = load_model() | |
| # Make a prediction when the user clicks the "Predict" button | |
| if st.button('Predict Model'): | |
| predicted_value = model_prediction(model, features) | |
| if predicted_value=='0': | |
| st.success('The Mobile Price is Low') | |
| elif predicted_value=='1': | |
| st.success('The Mobile Price is Medium') | |
| elif predicted_value=='2': | |
| st.success('The Mobile Price is High') | |
| else: | |
| st.success('The Mobile Price is Very High') | |
| def about_hidevs(): | |
| components.html(""" | |
| <div> | |
| <h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4> | |
| <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> | |
| <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> | |
| <p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p> | |
| <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> | |
| <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> | |
| <p class="subtitle">💡 Join us now, and turbocharge your career!</p> | |
| <p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a> | |
| <a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a> | |
| <a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a> | |
| <a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a> | |
| <a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a> | |
| <a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p> | |
| </div> | |
| """, | |
| height=600) | |
| def main(): | |
| # Set the app title and add your website name and logo | |
| st.set_page_config( | |
| page_title="Mobile Price Classification", | |
| page_icon=":chart_with_upwards_trend:", | |
| ) | |
| st.title("Welcome to our Mobile Price Classification App!") | |
| app_design() | |
| st.header("About HiDevs Community") | |
| about_hidevs() | |
| if __name__ == '__main__': | |
| main() | |