Spaces:
Sleeping
Sleeping
Commit
·
f3f9d1c
1
Parent(s):
88f86da
Update app.py
Browse files
app.py
CHANGED
@@ -209,8 +209,8 @@ for i in range(row_count):
|
|
209 |
|
210 |
def get_table_download_link(df, filename="data.csv", text="Download CSV file"):
|
211 |
csv = df.to_csv(index=False)
|
212 |
-
b64 = base64.b64encode(csv.encode()).decode()
|
213 |
-
href = f'{text}'
|
214 |
return href
|
215 |
|
216 |
# Create a list of lists containing all URLs, questions, and answers
|
|
|
209 |
|
210 |
def get_table_download_link(df, filename="data.csv", text="Download CSV file"):
|
211 |
csv = df.to_csv(index=False)
|
212 |
+
b64 = base64.b64encode(csv.encode()).decode() # some strings <-> bytes conversions necessary here
|
213 |
+
href = f'<a href="data:file/csv;base64,{b64}" download="{filename}">{text}</a>'
|
214 |
return href
|
215 |
|
216 |
# Create a list of lists containing all URLs, questions, and answers
|