Hey,
I added a file_uploader field to my app (Thanks for this it’s amazing) and I was wondering if there is a way to set a default upload, much like how other fields like text_input have value as a keyword that I can use to set the default.
Thanks,
Kurt
Hey @kurt-rhee,
There’s no way to specify a default file for the uploder but you could check that fairly easy because when there’s no file uploaded it will return None
.
So you could do something like:
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
if uploaded_file is None:
# Some default stuff here :)
else:
data = pd.read_csv(uploaded_file)
st.write(data)
Thanks @arraydude I’ve implemented the file uploaded like so in my app!