Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,11 +13,13 @@ warnings.filterwarnings("ignore")
|
|
| 13 |
|
| 14 |
|
| 15 |
st.title('ReactionT5_task_forward')
|
| 16 |
-
st.markdown('
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 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 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 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 |
+
)
|
|
|
|
|
|
|
|
|