Upload a source file from my local and deploy the streamlit app on the browser

Summary

I have issue saying that the source file (Csv) used in the python script is not found (i guess it is stored in my local) when i run it on a web browser. My goal is to create an app that i can share the URL to other users.

Not sure if i have to store the file in Github repository or anywhere else. Its size is quire large 212 MB.
Help is a lot appreciated!

Here is the error:

ParserError: An error occurred while calling the read_csv method registered to the pandas backend. Original Message: Error tokenizing data. C error: Expected 1 fields in line 4, saw 3

Traceback:

File "/home/vscode/.local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 541, in _run_script
    exec(code, module.__dict__)File "/workspaces/Streamlit_App/Financial_Stock_Analysis__Tokyo_Stock_Exchange_.py", line 12, in <module>
    df = dd.read_csv('https://1drv.ms/u/s!Av5FrLYnIe5Rgn7VixCVO4h1NRQp?e=ekeolE')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/vscode/.local/lib/python3.11/site-packages/dask/backends.py", line 138, in wrapper
    raise type(e)(

Thanks all

Hello @Tram_Nguyen, welcome to our community!

A viable solution would be to host your CSV on a cloud storage platform, such as Google Cloud Storage, AWS S3, or Azure Blob Storage.

Have you tried these yet?

Thanks,
Charly

Hi Charly,

thanks for the reply. I’ve tried storing csv file in Google Drive but the format is distort dramatically which ended up into a HTML one.

Due to a large volume of file 208 MB, I uploaded it as Large file storage to Github repository, and run it in Streamlit. The problem is sometimes it works, sometimes a few errors incurrs and not the whole script is run smoothly on the app (only the first few parts… and it keeps running/connecting…). Not sure what to do to fix it ;/

Thanks
Tram

1 Like

Apologies for the confusion @Tram_Nguyen - I wasn’t referring to Google Drive but to the Cloud Storage service on Google Cloud Platform.

You can find more information about it here: Product overview of Cloud Storage  |  Google Cloud. It has a pretty generous free tier so you may want to try it!

Let me know if you have any questions about it.

Best,
Charly

Yeah, thanks for the hint. Shall check it out if necessary.

Best,
Tram

You’re welcome!

Quick tip: you may want to connect to cloud file storage via st-files-connection.

It will make your life easier! :blush:

Best wishes,
Charly

1 Like

Hi Charly,

I tried to set up connection between Streamlit and google cloud storage (where my source file is stored in a bucket) got the secrets as json file dowloaded in local folder. However, i have no clue how to get the authentication info work via python script without exposing the secret value to the public because there is no point storing it in local. I tried various ways such as set up secret environment variable in Streamlit Cloud Dashboard but failed… no idea where to store this string of secret values where i can access it easily.

Hope you get the point!? Sorry for lengthy description if i don’t understand the issue to its nature.

Thanks a lot for the support

Best
Tram

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.