manika07 commited on
Commit
276552d
·
1 Parent(s): 3c1b261

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -81,16 +81,12 @@ if uploaded_file is not None:
81
  df['category'] = df['Abstract'].apply(predict_category)
82
  st.dataframe(df)
83
 
84
- # Create download tab
85
- with st.sidebar:
86
- st.header("Download")
87
- if st.button("Download CSV file"):
88
- download_csv(df)
89
-
90
- def download_csv(df):
91
- """Downloads a CSV file from the given DataFrame."""
92
- b64_df = base64.b64encode(df.to_csv().encode()).decode()
93
- headers = {"Content-Disposition": "attachment; filename=data.csv"}
94
- st.download_file(b64_df, "data.csv", headers=headers)
95
-
96
 
 
 
 
 
 
 
 
81
  df['category'] = df['Abstract'].apply(predict_category)
82
  st.dataframe(df)
83
 
84
+ st.sidebar.header("Download Results")
85
+ st.sidebar.text("Download the tagged results as a CSV file.")
 
 
 
 
 
 
 
 
 
 
86
 
87
+ # Create a download button
88
+ if st.sidebar.button("Download"):
89
+ csv = df.to_csv(index=False)
90
+ b64 = base64.b64encode(csv.encode()).decode()
91
+ headers = {"Content-Disposition": "attachment; filename=data.csv"}
92
+ st.download_file(b64, "data.csv", headers=headers)