Expected str, bytes or os.PathLike object, not UploadedFile, Error

Hello, i tried collecting ML model from user by using the st.file_upload function.

But I keep getting the type error. Please help out

  1. This I the function I’m trying to run , that reads input data from users and returns a visualization

  2. This is me trying to call the function.

  3. This is the error I keep getting

I’ll really appreciate a response.

Hello @nelsonchristof

You would need to read the uploaded file variable to convert it to bytes which can then be passed to the function to use the ML model.

Please refer to the link - API reference — Streamlit 0.80.0 documentation

Hope this helps!

1 Like

Now that i have read the model with uploaded_file.read() … I need the model to perform a .predict function and loading the bytes_data with pickle still gives an error

I’ll really appreciate a response, this is an important personal project I’m working on.

Thanks

I have used fastai to predict output for a sample image having .pickle file as model format.

Please have a look on this :slight_smile:

Cheers,
All the best !!

is there an equivalent of “learn_loader” for sklearn. I think if there’s something like that for sklearn my job would be much easy.

please help.

thanks

somebody help, please. i came a long way with this project. i dont want to drop it now.