Update app.py
Browse files
app.py
CHANGED
@@ -85,14 +85,9 @@ if uploaded_file is not None:
|
|
85 |
st.sidebar.header("Download Results")
|
86 |
st.sidebar.text("Download the tagged results as a CSV file.")
|
87 |
|
88 |
-
# Create download
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
def download_csv(df):
|
95 |
-
"""Downloads a CSV file from the given DataFrame."""
|
96 |
-
b64_df = base64.b64encode(df.to_csv().encode()).decode()
|
97 |
-
headers = {"Content-Disposition": "attachment; filename=data.csv"}
|
98 |
-
return st.download_file(b64_df, "data.csv", headers=headers)
|
|
|
85 |
st.sidebar.header("Download Results")
|
86 |
st.sidebar.text("Download the tagged results as a CSV file.")
|
87 |
|
88 |
+
# Create a download button
|
89 |
+
if st.sidebar.button("Download"):
|
90 |
+
csv = df.to_csv(index=False)
|
91 |
+
b64 = base64.b64encode(csv.encode()).decode()
|
92 |
+
href = f'<a href="data:file/csv;base64,{b64}" download="results.csv">Download csv file</a>'
|
93 |
+
st.markdown(href, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|