Eachan Johnson commited on
Commit
756d4d1
·
1 Parent(s): ac04716

Fix file prediction

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -198,6 +198,9 @@ def predict_file(
198
  species_to_predict = cast(predict, to=list)
199
  prediction_cols = []
200
  for species in species_to_predict:
 
 
 
201
  this_modelbox = MODELBOXES[species]
202
  this_features = this_modelbox._input_cols
203
  this_labels = this_modelbox._label_cols
@@ -208,10 +211,12 @@ def predict_file(
208
  })
209
  .assign(**{label: np.nan for label in this_labels})
210
  )
 
211
  prediction = this_modelbox.predict(
212
  data=this_prediction_input,
213
  features=this_features,
214
  labels=this_labels,
 
215
  cache="./cache"
216
  ).with_format("numpy")["__prediction__"].flatten()
217
  print(prediction)
@@ -224,6 +229,8 @@ def predict_file(
224
  this_col = f"{species}: {extra_metric}"
225
  prediction_cols.append(this_col)
226
  print(">>>", this_modelbox._input_training_data)
 
 
227
  this_extra = (
228
  EXTRA_METRICS[extra_metric](
229
  this_modelbox,
@@ -231,7 +238,7 @@ def predict_file(
231
  )
232
  .with_format("numpy")
233
  )
234
- prediction_df[this_col] = this_extra[this_extra.column_names[0]]
235
 
236
  return prediction_df[['id'] + prediction_cols + ['smiles', 'inchikey', "mwt", "clogp"]]
237
 
 
198
  species_to_predict = cast(predict, to=list)
199
  prediction_cols = []
200
  for species in species_to_predict:
201
+ message = f"Predicting for species: {species}"
202
+ print_err(message)
203
+ gr.Info(message, duration=3)
204
  this_modelbox = MODELBOXES[species]
205
  this_features = this_modelbox._input_cols
206
  this_labels = this_modelbox._label_cols
 
211
  })
212
  .assign(**{label: np.nan for label in this_labels})
213
  )
214
+ print(this_prediction_input)
215
  prediction = this_modelbox.predict(
216
  data=this_prediction_input,
217
  features=this_features,
218
  labels=this_labels,
219
+ aggregator="mean",
220
  cache="./cache"
221
  ).with_format("numpy")["__prediction__"].flatten()
222
  print(prediction)
 
229
  this_col = f"{species}: {extra_metric}"
230
  prediction_cols.append(this_col)
231
  print(">>>", this_modelbox._input_training_data)
232
+ print(">>>", this_modelbox._input_training_data.format)
233
+ print(">>>", this_modelbox._in_key, this_modelbox._out_key)
234
  this_extra = (
235
  EXTRA_METRICS[extra_metric](
236
  this_modelbox,
 
238
  )
239
  .with_format("numpy")
240
  )
241
+ prediction_df[this_col] = this_extra[this_extra.column_names[-1]]
242
 
243
  return prediction_df[['id'] + prediction_cols + ['smiles', 'inchikey', "mwt", "clogp"]]
244