File Uploader with Streamlit

Should you require your app users to upload files that will be involved in computation, you can use the file_uploader widget. By default, it allows you to upload files up to 200MB. This can be changed in configuration to suit your requirements. We’ll explore Streamlit configuration later in this article.

You can specify the file types to upload. If no type is specified, all extensions can be uploaded.

file = st.file_uploader(“Select a file to upload”, type = [“csv”, “txt”])

if file is not None: df = pd.read_csv(file) st.dataframe(df.sample(10))

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy