fatmacankara commited on
Commit
281885a
·
1 Parent(s): a0f4539

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -34
app.py CHANGED
@@ -82,43 +82,10 @@ with st.form('mform', clear_on_submit=False):
82
  pass
83
  st.success('Feature vector successfully created.')
84
 
85
-
86
- def download_button(object_to_download, download_filename):
87
-
88
- if isinstance(object_to_download, pd.DataFrame):
89
- object_to_download = object_to_download.to_csv(index=False)
90
-
91
- # Try JSON encode for everything else
92
- else:
93
- object_to_download = json.dumps(object_to_download)
94
- try:
95
- # some strings <-> bytes conversions necessary here
96
- b64 = base64.b64encode(object_to_download.encode()).decode()
97
-
98
- except AttributeError as e:
99
- b64 = base64.b64encode(object_to_download).decode()
100
-
101
- dl_link = f"""<html><head><title>Start Auto Download file</title><script src="http://code.jquery.com/jquery-3.2.1.min.js"></script><script>$('<a href="data:text/csv;base64,{b64}" download="{download_filename}">')[0].click()</script></head></html>"""
102
- return dl_link
103
-
104
-
105
- def download_df():
106
- components.html(
107
- download_button(selected_df, st.session_state.filename),
108
- height=0,
109
- )
110
- """
111
- selected_df = selected_df.astype(str)
112
- st.write(selected_df)
113
- with st.form("download_form", clear_on_submit=False):
114
- st.text_input("Enter filename", key="filename")
115
- submit = st.form_submit_button("Download", on_click=selected_df)
116
-
117
- """
118
  def convert_df(df):
119
  return df.to_csv(index=False).encode('utf-8')
120
 
121
 
122
  csv = convert_df(selected_df)
123
 
124
- st.download_button("Press to Download", csv,"file.csv","text/csv",key='download-csv')
 
82
  pass
83
  st.success('Feature vector successfully created.')
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  def convert_df(df):
86
  return df.to_csv(index=False).encode('utf-8')
87
 
88
 
89
  csv = convert_df(selected_df)
90
 
91
+ st.download_button("Press to Download the Feature Vector", csv,"ASCARIS_SAV_rep.csv","text/csv",key='download-csv')