manika07 commited on
Commit
29e8203
·
1 Parent(s): 998a063

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import pandas as pd
3
  import pickle
4
  import requests
5
  import base64
 
6
 
7
  #===config===
8
  st.set_page_config(
@@ -84,8 +85,14 @@ if uploaded_file is not None:
84
  st.sidebar.header("Download Results")
85
  st.sidebar.text("Download the tagged results as a CSV file.")
86
 
 
 
 
 
 
 
87
  def download_csv(df):
88
  """Downloads a CSV file from the given DataFrame."""
89
  b64_df = base64.b64encode(df.to_csv().encode()).decode()
90
  headers = {"Content-Disposition": "attachment; filename=data.csv"}
91
- return st.download_file(b64_df, "data.csv", headers=headers)
 
3
  import pickle
4
  import requests
5
  import base64
6
+ from streamlit.components.file_uploader import st.download_file
7
 
8
  #===config===
9
  st.set_page_config(
 
85
  st.sidebar.header("Download Results")
86
  st.sidebar.text("Download the tagged results as a CSV file.")
87
 
88
+ # Create download tab
89
+ with st.sidebar:
90
+ st.header("Download")
91
+ if st.button("Download CSV file"):
92
+ download_csv(df)
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)