Spaces:
Sleeping
Sleeping
Zekun Wu
commited on
Commit
·
30ad011
1
Parent(s):
6d335d2
update
Browse files
app.py
CHANGED
@@ -126,8 +126,18 @@ if st.button("Generate Potshots"):
|
|
126 |
st.write("### Generated Potshots")
|
127 |
st.dataframe(df)
|
128 |
|
129 |
-
# Provide a download button for the Excel file
|
130 |
-
st.write("### Download Potshots")
|
131 |
excel_data = to_excel(df)
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
st.write("### Generated Potshots")
|
127 |
st.dataframe(df)
|
128 |
|
|
|
|
|
129 |
excel_data = to_excel(df)
|
130 |
+
file_name = "potshots.xlsx"
|
131 |
+
|
132 |
+
# Open and read the file to serve for download
|
133 |
+
with open(file_name, "wb") as f:
|
134 |
+
f.write(excel_data)
|
135 |
+
|
136 |
+
# Provide a download button for the Excel file
|
137 |
+
with open(file_name, "rb") as template_file:
|
138 |
+
template_byte = template_file.read()
|
139 |
+
|
140 |
+
st.download_button(label="Click to Download Potshots File",
|
141 |
+
data=template_byte,
|
142 |
+
file_name="potshots.xlsx",
|
143 |
+
mime='application/octet-stream')
|