fadliaulawi
commited on
Commit
·
8fe9391
1
Parent(s):
c80bf6e
Change download button
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import io
|
2 |
-
import os
|
3 |
import pandas as pd
|
4 |
import streamlit as st
|
5 |
|
@@ -137,9 +136,12 @@ if uploaded_files and submit:
|
|
137 |
dataframe.to_excel(writer, sheet_name='Original')
|
138 |
writer.close()
|
139 |
|
140 |
-
st.
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
145 |
)
|
|
|
1 |
import io
|
|
|
2 |
import pandas as pd
|
3 |
import streamlit as st
|
4 |
|
|
|
136 |
dataframe.to_excel(writer, sheet_name='Original')
|
137 |
writer.close()
|
138 |
|
139 |
+
st.markdown(
|
140 |
+
create_download_link(
|
141 |
+
"application/vnd.ms-excel",
|
142 |
+
buffer.getvalue(),
|
143 |
+
f"{uploaded_file.name.replace('.pdf', '')}_{chunk_option}_{model.split('-')[0]}_{model_val.split('-')[0]}.xlsx",
|
144 |
+
"Save Result"
|
145 |
+
),
|
146 |
+
unsafe_allow_html=True
|
147 |
)
|
utils.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import os
|
2 |
import pandas as pd
|
3 |
import re
|
@@ -120,3 +121,7 @@ def integrate(df):
|
|
120 |
df.reset_index(drop=True, inplace=True)
|
121 |
|
122 |
return df
|
|
|
|
|
|
|
|
|
|
1 |
+
import base64
|
2 |
import os
|
3 |
import pandas as pd
|
4 |
import re
|
|
|
121 |
df.reset_index(drop=True, inplace=True)
|
122 |
|
123 |
return df
|
124 |
+
|
125 |
+
def create_download_link(type, val, filename, message):
|
126 |
+
b64 = base64.b64encode(val)
|
127 |
+
return f'<a href="data:{type};base64,{b64.decode()}" download="{filename}">{message}</a>'
|