emmas96 commited on
Commit
7a3382d
·
1 Parent(s): 6146fc6

final download option

Browse files
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -52,12 +52,6 @@ def about_page():
52
  )
53
 
54
  st.image('figures/hyper-dti.png', caption='Overview of HyperPCM architecture.')
55
-
56
-
57
- @st.cache
58
- def convert_df(df):
59
- # IMPORTANT: Cache the conversion to prevent computation on every rerun
60
- return df.to_csv().encode('utf-8')
61
 
62
 
63
  def retrieval():
@@ -161,9 +155,7 @@ def retrieval():
161
  mol_img = Chem.Draw.MolToImage(mol)
162
  st.image(mol_img, caption=f"{results.loc[j + 5*i, 'Prediction']:.2f}")
163
 
164
- st.download_button('Download retrieved drug compounds.', convert_df(results.head(selected_k)), file_name='retrieved_drugs.csv')
165
-
166
- st.markdown('## TMP title')
167
 
168
  elif query_embedding is not None:
169
  st.markdown('### Inference')
@@ -213,9 +205,7 @@ def retrieval():
213
  mol_img = Chem.Draw.MolToImage(mol)
214
  st.image(mol_img, caption=f"{results.loc[j + 5*i, 'Prediction']:.2f}")
215
 
216
- st.download_button('Download retrieved drug compounds.', convert_df(results.head(selected_k)), file_name='retrieved_drugs.csv')
217
-
218
- st.markdown('## TMP title')
219
 
220
  page_names_to_func = {
221
  'Retrieval': retrieval,
 
52
  )
53
 
54
  st.image('figures/hyper-dti.png', caption='Overview of HyperPCM architecture.')
 
 
 
 
 
 
55
 
56
 
57
  def retrieval():
 
155
  mol_img = Chem.Draw.MolToImage(mol)
156
  st.image(mol_img, caption=f"{results.loc[j + 5*i, 'Prediction']:.2f}")
157
 
158
+ st.download_button('Download retrieved drug compounds.', results.head(selected_k).to_csv().encode('utf-8'), file_name='retrieved_drugs.csv')
 
 
159
 
160
  elif query_embedding is not None:
161
  st.markdown('### Inference')
 
205
  mol_img = Chem.Draw.MolToImage(mol)
206
  st.image(mol_img, caption=f"{results.loc[j + 5*i, 'Prediction']:.2f}")
207
 
208
+ st.download_button('Download retrieved drug compounds.', results.head(selected_k).to_csv().encode('utf-8'), file_name='retrieved_drugs.csv')
 
 
209
 
210
  page_names_to_func = {
211
  'Retrieval': retrieval,