Streamlit APP deployment : error not recognizing my own functions


I’m trying to deploy my streamlit app and learning how to do it at the same thime. In the local way, the streamlit app works.

Here how it works : I have “” which is my script with all the function I need for the preprocessing and the modelisation. And I have “” which is the script for the streamlit app. When I run “” it seems that all the error are related to the first script “”. After several try, It seems that Streamlit doesn’t take in count my script “” because all the errors refers to the functions declare in “”.

Here the error message:

My repo is here : link

Does anyone know how to fix that ? I need to deploy it for an application but it work only in local on my laptop.

Thank you

Ahd here what i am expected to see (in the local way it works):

Hi @Mrss,

It looks like there’s an error with one of the underlying files in your dataset. The two things that I did to help debug this were:

  1. Look at the logs in the sidebar (that way you can see the actual error message). I deployed a fork of the repo in order to do this on my own, and I saw
AttributeError: 'DataFrame' object has no attribute 'imageid'

Ah, so it has something to do with the dataframe object itself and perhaps a missing column.
2. Use st.write for debugging. print() also works, but I like to use st.write especially for dataframes, so that I can see and explore them.
You can see the write statement I added here Data_challenge_RAKUTEN/ at main · blackary/Data_challenge_RAKUTEN · GitHub
And the output here:

Note that there is a column called imageid;;;;;;;;;;....
My guess is that you are using semicolons to separate the columns in your csv, and pandas is expecting commas, so you need to pass an extra argument when reading the csv to tell it to use semicolons.

However, the main thing is that you can use these techniques to do your own digging in and debugging. Hope that’s helpful!

(P.S. For a large dataset, you might consider using parquet rather than csv, as it will be more compressed, and tends to have fewer problems than csv. It’s not human-readable as a file, but with files that are large, that doesn’t tend to matter too much).

1 Like

Hi @blackary ,

Thanks a lot.
Now i found others mistakes but your explanations and example helps me a lot. Really hopeful!

It’s very strange because in my local it works.