Update app.py
Browse files
app.py
CHANGED
@@ -81,13 +81,16 @@ if uploaded_file is not None:
|
|
81 |
df['category'] = df['Abstract'].apply(predict_category)
|
82 |
st.dataframe(df)
|
83 |
|
84 |
-
|
85 |
-
st.sidebar
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
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 |
+
|