sagawa commited on
Commit
bd5de6d
·
1 Parent(s): 429c1cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -144,22 +144,22 @@ if st.button('predict'):
144
  output.append(None)
145
 
146
 
147
- if CFG.num_beams > 1:
148
- output_df = pd.DataFrame(np.array(output).reshape(1, -1), columns=['input'] + [f'{i}th' for i in range(CFG.num_beams)] + ['valid compound'] + [f'{i}th score' for i in range(CFG.num_beams)] + ['valid compound score'])
149
- else:
150
- output_df = pd.DataFrame(np.array([input_compound]+output).reshape(1, -1), columns=['input', '0th', 'valid compound'])
151
- st.table(output_df)
152
-
153
- @st.cache
154
- def convert_df(df):
155
- # IMPORTANT: Cache the conversion to prevent computation on every rerun
156
- return df.to_csv(index=False)
157
-
158
- csv = convert_df(output_df)
159
-
160
- st.download_button(
161
- label="Download data as CSV",
162
- data=csv,
163
- file_name='output.csv',
164
- mime='text/csv',
165
- )
 
144
  output.append(None)
145
 
146
 
147
+ if CFG.num_beams > 1:
148
+ output_df = pd.DataFrame(np.array(output).reshape(1, -1), columns=['input'] + [f'{i}th' for i in range(CFG.num_beams)] + ['valid compound'] + [f'{i}th score' for i in range(CFG.num_beams)] + ['valid compound score'])
149
+ else:
150
+ output_df = pd.DataFrame(np.array([input_compound]+output).reshape(1, -1), columns=['input', '0th', 'valid compound'])
151
+ st.table(output_df)
152
+
153
+ @st.cache
154
+ def convert_df(df):
155
+ # IMPORTANT: Cache the conversion to prevent computation on every rerun
156
+ return df.to_csv(index=False)
157
+
158
+ csv = convert_df(output_df)
159
+
160
+ st.download_button(
161
+ label="Download data as CSV",
162
+ data=csv,
163
+ file_name='output.csv',
164
+ mime='text/csv',
165
+ )