sagawa commited on
Commit
965bb86
·
verified ·
1 Parent(s): 20946b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -20
app.py CHANGED
@@ -13,11 +13,13 @@ warnings.filterwarnings("ignore")
13
 
14
 
15
  st.title('ReactionT5_task_forward')
16
- st.markdown('##### At this space, you can predict the products of reactions from their inputs.')
17
- st.markdown('##### The code expects input_data as a string or CSV file that contains an "input" column. The format of the string or contents of the column are like "REACTANT:{reactants of the reaction}REAGENT:{reagents, catalysts, or solvents of the reaction}".')
18
- st.markdown('##### If there is no reagent, fill the blank with a space. And if there are multiple compounds, concatenate them with "."')
19
- st.markdown('##### The output contains smiles of predicted products and sum of log-likelihood for each prediction. Predictions are ordered by their log-likelihood.(0th is the most probable product.)')
20
-
 
 
21
 
22
  display_text = 'input the reaction smiles (e.g. REACTANT:COC(=O)C1=CCCN(C)C1.O.[Al+3].[H-].[Li+].[Na+].[OH-]REAGENT:C1CCOC1)'
23
 
@@ -177,18 +179,15 @@ if st.button('predict'):
177
 
178
  output_df = save_multiple_predictions(input_data, all_sequences, all_scores)
179
 
180
- st.table(output_df)
181
-
182
- @st.cache
183
- def convert_df(df):
184
- # IMPORTANT: Cache the conversion to prevent computation on every rerun
185
- return df.to_csv(index=False)
186
-
187
- csv = convert_df(output_df)
188
-
189
- st.download_button(
190
- label="Download data as CSV",
191
- data=csv,
192
- file_name='output.csv',
193
- mime='text/csv',
194
- )
 
13
 
14
 
15
  st.title('ReactionT5_task_forward')
16
+ st.markdown('''
17
+ ##### At this space, you can predict the products of reactions from their inputs.
18
+ ##### The code expects input_data as a string or CSV file that contains an "input" column.
19
+ ##### The format of the string or contents of the column should be "REACTANT:{reactants}REAGENT:{reagents}".
20
+ ##### If there is no reagent, fill the blank with a space. For multiple compounds, concatenate them with ".".
21
+ ##### The output contains SMILES of predicted products and the sum of log-likelihood for each prediction, ordered by their log-likelihood (0th is the most probable product).
22
+ ''')
23
 
24
  display_text = 'input the reaction smiles (e.g. REACTANT:COC(=O)C1=CCCN(C)C1.O.[Al+3].[H-].[Li+].[Na+].[OH-]REAGENT:C1CCOC1)'
25
 
 
179
 
180
  output_df = save_multiple_predictions(input_data, all_sequences, all_scores)
181
 
182
+ @st.cache
183
+ def convert_df(df):
184
+ return df.to_csv(index=False)
185
+
186
+ csv = convert_df(output_df)
187
+
188
+ st.download_button(
189
+ label="Download data as CSV",
190
+ data=csv,
191
+ file_name='output.csv',
192
+ mime='text/csv',
193
+ )