Eachan Johnson commited on
Commit
53ffacc
·
1 Parent(s): 1f8ab46

Fix file prediction

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -95,7 +95,7 @@ def predict_one(
95
  prediction_df = convert_one(
96
  strings=strings,
97
  input_representation=input_representation,
98
- output_representation=['id', 'smiles', 'inchikey', "mwt", "clogp"],
99
  )
100
  species_to_predict = cast(predict, to=list)
101
  prediction_cols = []
@@ -143,7 +143,7 @@ def predict_one(
143
  prediction_df[this_col] = this_extra[this_extra.column_names[-1]]
144
 
145
  return gr.DataFrame(
146
- prediction_df[['id'] + prediction_cols + ['smiles', 'inchikey', "mwt", "clogp"]],
147
  visible=True
148
  )
149
 
@@ -339,13 +339,12 @@ with gr.Blocks() as demo:
339
  label="Download predictions",
340
  visible=False,
341
  )
342
- with gr.Row():
343
- output_line = gr.DataFrame(
344
- label="Predictions",
345
- interactive=False,
346
- visible=False,
347
- )
348
- drawing = gr.Image(label="Chemical structures")
349
  gr.on(
350
  [
351
  input_line.submit,
@@ -395,6 +394,12 @@ with gr.Blocks() as demo:
395
  value=list(MODEL_REPOS)[:1],
396
  interactive=True,
397
  )
 
 
 
 
 
 
398
  go_button2 = gr.Button(
399
  value="Predict!",
400
  )
@@ -416,12 +421,13 @@ with gr.Blocks() as demo:
416
  outputs=[input_data, input_column]
417
  )
418
  go_button2.click(
419
- convert_file,
420
  inputs=[
421
  input_data,
422
  input_column,
423
  input_format,
424
  output_species,
 
425
  ],
426
  outputs={
427
  input_data,
 
95
  prediction_df = convert_one(
96
  strings=strings,
97
  input_representation=input_representation,
98
+ output_representation=['id', 'pubhem_name', 'pubchem_id', 'smiles', 'inchikey', "mwt", "clogp"],
99
  )
100
  species_to_predict = cast(predict, to=list)
101
  prediction_cols = []
 
143
  prediction_df[this_col] = this_extra[this_extra.column_names[-1]]
144
 
145
  return gr.DataFrame(
146
+ prediction_df[['id', 'pubhem_name', 'pubhem_id'] + prediction_cols + ['smiles', 'inchikey', "mwt", "clogp"]],
147
  visible=True
148
  )
149
 
 
339
  label="Download predictions",
340
  visible=False,
341
  )
342
+ output_line = gr.DataFrame(
343
+ label="Predictions",
344
+ interactive=False,
345
+ visible=False,
346
+ )
347
+ drawing = gr.Image(label="Chemical structures")
 
348
  gr.on(
349
  [
350
  input_line.submit,
 
394
  value=list(MODEL_REPOS)[:1],
395
  interactive=True,
396
  )
397
+ extra_metric_file = gr.CheckboxGroup(
398
+ label="Extra metrics (can increase calculation time!)",
399
+ choices=list(EXTRA_METRICS),
400
+ value=list(EXTRA_METRICS)[:2],
401
+ interactive=True,
402
+ )
403
  go_button2 = gr.Button(
404
  value="Predict!",
405
  )
 
421
  outputs=[input_data, input_column]
422
  )
423
  go_button2.click(
424
+ predict_file,
425
  inputs=[
426
  input_data,
427
  input_column,
428
  input_format,
429
  output_species,
430
+ extra_metric_file,
431
  ],
432
  outputs={
433
  input_data,