awacke1 commited on
Commit
0c99270
·
1 Parent(s): eba54ac

Update download.py

Browse files
Files changed (1) hide show
  1. download.py +0 -21
download.py CHANGED
@@ -83,12 +83,6 @@ def download_button(object_to_download, download_filename, button_text):
83
  download_link(your_df, 'YOUR_DF.csv', 'Click to download data!')
84
  download_link(your_str, 'YOUR_STRING.txt', 'Click to download text!')
85
  """
86
- # if pickle_it:
87
- # try:
88
- # object_to_download = pickle.dumps(object_to_download)
89
- # except pickle.PicklingError as e:
90
- # st.write(e)
91
- # return None
92
 
93
  # if:
94
  if isinstance(object_to_download, bytes):
@@ -141,20 +135,5 @@ def download_button(object_to_download, download_filename, button_text):
141
  custom_css
142
  + f'<a download="{download_filename}" id="{button_id}" href="data:file/txt;base64,{b64}">{button_text}</a><br><br>'
143
  )
144
- # dl_link = f'<a download="{download_filename}" id="{button_id}" href="data:file/txt;base64,{b64}"><input type="button" kind="primary" value="{button_text}"></a><br></br>'
145
 
146
  st.markdown(dl_link, unsafe_allow_html=True)
147
-
148
-
149
- # def download_link(
150
- # content, label="Download", filename="file.txt", mimetype="text/plain"
151
- # ):
152
- # """Create a HTML link to download a string as a file."""
153
- # # From: https://discuss.streamlit.io/t/how-to-download-file-in-streamlit/1806/9
154
- # b64 = base64.b64encode(
155
- # content.encode()
156
- # ).decode() # some strings <-> bytes conversions necessary here
157
- # href = (
158
- # f'<a href="data:{mimetype};base64,{b64}" download="{filename}">{label}</a>'
159
- # )
160
- # return href
 
83
  download_link(your_df, 'YOUR_DF.csv', 'Click to download data!')
84
  download_link(your_str, 'YOUR_STRING.txt', 'Click to download text!')
85
  """
 
 
 
 
 
 
86
 
87
  # if:
88
  if isinstance(object_to_download, bytes):
 
135
  custom_css
136
  + f'<a download="{download_filename}" id="{button_id}" href="data:file/txt;base64,{b64}">{button_text}</a><br><br>'
137
  )
 
138
 
139
  st.markdown(dl_link, unsafe_allow_html=True)