streamlit version 1.12.2
python version 3.9.13
Hey Streamlit Community - I am attempting to use the download_button component, but not quite sure how the “data” accepts a “file” value. I see from the docs that a file can be submitted as the data, and I have a file that was generated and available in the same directory.
Any thoughts on what I may be missing or how to approach this?
with open('data.jsonl', 'w') as jsonfile:
for line in data_list:
jsonfile.write(json.dumps(line)+'\n')
st.download_button(label="Download JSON", data=jsonfile, file_name='data.jsonl', mime='application/json')
Additionally, I’ve tried to 1) include a “path” to the file 2) put the path as a string, and 3) insert the jsonlife variable as shown above as the data source. Any guidance would be appreciated. Thanks