Spaces:
Build error
Build error
Update app.py
#1
by AjiNiktech - opened
6 unmodified lines789101112136 unmodified lines20212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061076 unmodified lines# Load the pickled modeldef load_model():return pickle.load(open('Income_classification_ra.pkl', 'rb'))# Function for model predictiondef model_prediction(model, features):6 unmodified linesdef app_design():# Add input fields for High, Open, and Low valuesimage = '18.png'st.image(image, use_column_width=True)st.subheader("Enter the following values:")Age = st.number_input("Age")Workclass = st.text_input("Workclass")Workclass = transform([Workclass])Final_weight = st.number_input("Final_weight")Education = st.text_input("Education")Education=transform([Education])Education_Num = st.number_input("Education_Num")Marital_status = st.text_input("Marital_status")Marital_status=transform([Marital_status])Occupation = st.text_input("Occupation")Occupation=transform([Occupation])Relationship = st.text_input("Relationship")Relationship=transform([Relationship])Race = st.text_input("Race")Race=transform([Race])Sex = st.selectbox("Sex",('Male','Female'))if Sex == 'Male':Sex = 1else:Sex = 0Capital_gain = st.number_input("Capital_gain")Capital_loss = st.number_input("Capital_loss")Hours_per_week = st.number_input("Hours_per_week")Native_country = st.text_input("Native_country")Native_country=transform([Native_country])# Create a feature list from the user inputsfeatures = [[Age, Workclass, Final_weight, Education, Education_Num, Marital_status, Occupation,Relationship,Race,Sex,Capital_gain,Capital_loss,Hours_per_week,Native_country]]# Load the modelmodel = load_model()# Make a prediction when the user clicks the "Predict" buttonif st.button('Predict Income'):predicted_value = model_prediction(model, features)if predicted_value=='1':predicted_value='greater then 50000'else:predicted_value='less then or equal to 50000'st.success(f"The Income is: {predicted_value}")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 logost.set_page_config(page_title="Income Classification",page_icon=":chart_with_upwards_trend:",)st.title("Welcome to our Income Classification App!")app_design()st.header("About HiDevs Community")about_hidevs()if __name__ == '__main__':main()6 unmodified lines789101112136 unmodified lines20212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666 unmodified lines# Load the pickled modeldef load_model():return pickle.load(open('Diamond_Price_Prediction_LinearRegression.pkl', 'rb'))# Function for model predictiondef model_prediction(model, features):6 unmodified linesdef app_design():# Add input fields for High, Open, and Low valuesimage = ''st.image(image, use_column_width=True)st.subheader("Enter the following values:")Carat = st.number_input("Carat(Weight of Daimond)")Cut = st.text_input("Cut(Quality) ('Ideal','Premium','Good','Very Good','Fair')")Cut = transform([Cut])Color = st.text_input("Color ('E','I','J','H','F','G','D')")Color=transform([Color])Clarity = st.text_input("Clarity ('SI2','SI1','VS1','VS2','VVS2','VVS1','I1','IF')")Clarity=transform([Clarity])Depth = st.number_input("Depth")Table = st.number_input("Table")X_length = st.number_input("X length")Y_width = st.number_input("Y width")Z_depth = st.number_input("Z depth")# Create a feature list from the user inputsfeatures = [[Carat,Cut,Color,Clarity,Depth,Table,X_length,Y_width,Z_depth]]# Load the modelmodel = load_model()# Make a prediction when the user clicks the "Predict" buttonif st.button('Predict Price'):predicted_value = model_prediction(model, features)st.success(f"The Price is: {predicted_value}")def main():# Set the app title and add your website name and logost.set_page_config(page_title="Diamond Price Prediction",page_icon=":chart_with_upwards_trend:",)st.title("Welcome to our Diamond Price Prediction App!")if __name__ == '__main__':main()
app.py+20-61