Getting network error when uploading file in streamlit

Hello Team,

I tried to create an upload widget in Streamlit using st.file_uploader.

When trying to upload a file, I am getting Error: Network Error

This is the code I have used:

import streamlit as st
import pandas as pd

file1 = st.file_uploader('Upload Source file',type=['csv','xlsx'])

file2 = st.file_uploader('Upload Target file',type=['csv','xlsx'])

df1 = pd.read_csv(file1)
df2 = pd.read_csv(file2)

st.dataframe(df1.head())
st.dataframe(df2.head())

This is the issue I am getting

It will be very much helpful for an assistance in this

Regards,
Sudharshan.G

Hi @Sudharshan_Sunder -

Where are you deploying this app, locally, Streamlit Cloud or somewhere else?

Best,
Randy

Hi @ randyzwitch
I am facing the same issue. I am running the app on localhost (The file size is not more than 1MB)

Hello @Sudharshan_Sunder and @Tinu_Koshy !
I’ve seen this error happen to me when the file is still open. Try closing the file and then uploading it.