dexay commited on
Commit
78a4e21
·
1 Parent(s): c1ac79a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
2
  import pandas as pd
3
  import transformers
4
  import re
 
5
  import zipfile
6
  import postt
7
  from postt import postcor
@@ -305,15 +306,13 @@ if submit and len(x) != 0:
305
  mime='text/csv',
306
  )
307
 
308
- zzip = zipfile.ZipFile(zipf, 'r')
309
- #with open(zipf, "rb") as f:
310
- st.download_button(
311
- label ="Download each triple family in a CSV",
312
- data = zzip,
313
- file_name='TriplesCSVs.zip',
314
- mime="application/zip"
315
-
316
- )
317
 
318
 
319
 
 
2
  import pandas as pd
3
  import transformers
4
  import re
5
+ import base64
6
  import zipfile
7
  import postt
8
  from postt import postcor
 
306
  mime='text/csv',
307
  )
308
 
309
+ with open(zipf, "rb") as f:
310
+ bytes = f.read()
311
+ b64 = base64.b64encode(bytes).decode()
312
+ href = f'<a href="data:file/zip;base64,{b64}" download=\'allcsvs.zip\'>\
313
+ Click to download\
314
+ </a>'
315
+ st.sidebar.markdown(href, unsafe_allow_html=True)
 
 
316
 
317
 
318