Eachan Johnson commited on
Commit
0747c7e
·
1 Parent(s): 69a6087

Wrap column headers

Browse files
Files changed (2) hide show
  1. app.py +6 -7
  2. sources/header.md +1 -1
app.py CHANGED
@@ -163,10 +163,10 @@ def _prediction_loop(
163
  cache=CACHE,
164
  ).with_format("numpy")["__prediction__"].flatten()
165
  print(prediction)
166
- this_col = f"{species}:\npredicted MIC (µM)"
167
  df[this_col] = np.power(10., -prediction) * 1e6
168
  prediction_cols.append(this_col)
169
- this_col = f"{species}:\npredicted MIC (µg / mL)"
170
  df[this_col] = np.power(10., -prediction) * 1e3 * df["mwt"]
171
  prediction_cols.append(this_col)
172
 
@@ -175,7 +175,7 @@ def _prediction_loop(
175
  print_err(message)
176
  gr.Info(message, duration=10)
177
  # this_modelbox._input_training_data = this_modelbox._input_training_data.remove_columns([this_modelbox._in_key])
178
- this_col = f"{species}:\n{extra_metric}"
179
  prediction_cols.append(this_col)
180
  print(">>>", this_modelbox._input_training_data)
181
  print(">>>", this_modelbox._input_training_data.format)
@@ -221,7 +221,7 @@ def predict_one(
221
  "pinned_columns": 3,
222
  "visible": True,
223
  "wrap": True,
224
- "column_widths": [200] * df.shape[1],
225
  }
226
  if return_pd:
227
  return df, gr.DataFrame(**gradio_opts)
@@ -320,7 +320,7 @@ def predict_file(
320
  "pinned_columns": 3,
321
  "visible": True,
322
  "wrap": True,
323
- "column_widths": [200] * prediction_df.shape[1],
324
  }
325
 
326
  if return_pd:
@@ -497,7 +497,7 @@ def _initial_setup():
497
  interactive=True,
498
  ),
499
  "extras": gr.CheckboxGroup(
500
- label="Extra metrics (Doubscore & Information Sensitivity can increase calculation time to a couple of minutes!)",
501
  choices=list(EXTRA_METRICS),
502
  value=list(EXTRA_METRICS)[:2],
503
  interactive=True,
@@ -513,7 +513,6 @@ def _initial_setup():
513
  output_line = gr.DataFrame(
514
  label="Predictions (scroll left and right)",
515
  interactive=False,
516
- pinned_columns=3,
517
  visible=True,
518
  )
519
  download_single = gr.DownloadButton(
 
163
  cache=CACHE,
164
  ).with_format("numpy")["__prediction__"].flatten()
165
  print(prediction)
166
+ this_col = f"{species}: predicted MIC (µM)"
167
  df[this_col] = np.power(10., -prediction) * 1e6
168
  prediction_cols.append(this_col)
169
+ this_col = f"{species}: predicted MIC (µg / mL)"
170
  df[this_col] = np.power(10., -prediction) * 1e3 * df["mwt"]
171
  prediction_cols.append(this_col)
172
 
 
175
  print_err(message)
176
  gr.Info(message, duration=10)
177
  # this_modelbox._input_training_data = this_modelbox._input_training_data.remove_columns([this_modelbox._in_key])
178
+ this_col = f"{species}: {extra_metric}"
179
  prediction_cols.append(this_col)
180
  print(">>>", this_modelbox._input_training_data)
181
  print(">>>", this_modelbox._input_training_data.format)
 
221
  "pinned_columns": 3,
222
  "visible": True,
223
  "wrap": True,
224
+ "column_widths": [120] * 3 + [250] * (prediction_df.shape[1] - 3),
225
  }
226
  if return_pd:
227
  return df, gr.DataFrame(**gradio_opts)
 
320
  "pinned_columns": 3,
321
  "visible": True,
322
  "wrap": True,
323
+ "column_widths": [120] * 3 + [250] * (prediction_df.shape[1] - 3),
324
  }
325
 
326
  if return_pd:
 
497
  interactive=True,
498
  ),
499
  "extras": gr.CheckboxGroup(
500
+ label="Extra metrics (Doubtscore & Information Sensitivity can increase calculation time to a couple of minutes!)",
501
  choices=list(EXTRA_METRICS),
502
  value=list(EXTRA_METRICS)[:2],
503
  interactive=True,
 
513
  output_line = gr.DataFrame(
514
  label="Predictions (scroll left and right)",
515
  interactive=False,
 
516
  visible=True,
517
  )
518
  download_single = gr.DownloadButton(
sources/header.md CHANGED
@@ -4,7 +4,7 @@ Predictions are from an AI model trained on the wild-type accumulator subset of
4
  dataset](https://doi.org/10.1021/acsinfecdis.8b00193), available to browse
5
  [here](https://huggingface.co/datasets/scbirlab/thomas-2018-spark-wt).
6
 
7
- Predictions are given in micromolar (µM) and µg/mL. You can optionally have uncertainty scores calculated.
8
 
9
  This model was generated using [our Duvida framework](https://github.com/scbirlab/duvida), as a result of
10
  hyperparameter searches and selecting the model that performs best on unseen test data (from a scaffold split).
 
4
  dataset](https://doi.org/10.1021/acsinfecdis.8b00193), available to browse
5
  [here](https://huggingface.co/datasets/scbirlab/thomas-2018-spark-wt).
6
 
7
+ Predictions are given in micromolar (µM) and µg/mL. You can optionally have uncertainty scores calculated. These can take a few minutes, so please be patient.
8
 
9
  This model was generated using [our Duvida framework](https://github.com/scbirlab/duvida), as a result of
10
  hyperparameter searches and selecting the model that performs best on unseen test data (from a scaffold split).