Hey @Ash010110,
Thanks for sharing this question.
The st.file_uploader
widget doesn’t actually create a file when a file is uploaded; instead, the file is temporarily stored in memory (the return value is a BytesIO
object) – as a result, you wouldn’t be able to retrieve a path to the file.
If you need to pass the file itself to another function, you’ll need to add code to store the file somewhere (not in memory), and then you can use the path to that stored file (here’s a thread where someone shared how they used st.file_uploader and then stored the uploaded file in AWS S3, as an example).
Since the file is presumably saved on your local machine, you’re able to run the app locally and use the path to the local file.
Some threads that might be helpful: