0

Error in deployment with streamlit

import pandas as pd import numpy as np import streamlit as st import pickle from PIL import Image pickle_in = open(r"C:\Users\MAYUR\Desktop\Logistic Regression\Reg_model.pkl", 'rb') classifier = pickle.load(pickle_in) def welcome(): return 'welcome all' def prediction(Sex, Age, SibSp, Parch): prediction = classifier.predict([[Sex, Age, SibSp, Parch]]) print(prediction) return prediction def Main(): st.title('Titanic predictions') Sex = st.text_input("Sex",': M=1,F=0') Age = st.text_input("Age") SibSp = st.text_input("SibSp") Parch = st.text_input("Parch") result ="" if st.button("Predict"): result = prediction(Sex, Age, SibSp, Parch) st.success('The output is {}'.format(result)) if __name__=='__Main__': Main()

2nd Oct 2024, 4:59 AM
Prathamesh Sadvelkar
Prathamesh Sadvelkar - avatar
1 Odpowiedź
0
is there a space in the path? did you try to copy that file into the project's folder? and then add a relative path.... classifier.predict() — is it not in scikit-learn?
3rd Oct 2024, 6:07 PM
Mihaly Nyilas
Mihaly Nyilas - avatar