juliocesar-io commited on
Commit
80318b5
·
1 Parent(s): cd043d8

added model validation

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -14,6 +14,8 @@ PROJECT_URL = "https://www.nature.com/articles/s41598-022-12180-x"
14
 
15
  DEFAULT_PATH_DOCKER = "/home/user/app"
16
 
 
 
17
  def load_and_filter_data(protein_id, ligand_smiles):
18
 
19
  # generate random short id, make short
@@ -23,7 +25,12 @@ def load_and_filter_data(protein_id, ligand_smiles):
23
 
24
  # check that ligand_smiles is not empty
25
  if not ligand_smiles or ligand_smiles.strip() == "":
26
- error_msg = f"!SMILES string is required"
 
 
 
 
 
27
  raise gr.Error(error_msg, duration=5)
28
 
29
  # Split the input SMILES string by ':' to get a list
@@ -99,7 +106,7 @@ def create_interface():
99
  with gr.Column():
100
  gr.Markdown("#### Target Protein")
101
  protein_id = gr.Dropdown(
102
- choices=["ada"],
103
  label="Target Protein ID",
104
  info="Select the target protein from the dropdown menu.",
105
  value="ada"
 
14
 
15
  DEFAULT_PATH_DOCKER = "/home/user/app"
16
 
17
+ ENABLED_MODELS = ["ada"]
18
+
19
  def load_and_filter_data(protein_id, ligand_smiles):
20
 
21
  # generate random short id, make short
 
25
 
26
  # check that ligand_smiles is not empty
27
  if not ligand_smiles or ligand_smiles.strip() == "":
28
+ error_msg = f"!SMILES string is required 💥"
29
+ raise gr.Error(error_msg, duration=5)
30
+
31
+
32
+ if protein_id not in ENABLED_MODELS:
33
+ error_msg = f"!Invalid 💥 target protein ID, the available options are: {ENABLED_MODELS}. To do inference other proteins, you can run the model locally an train the model for each target protein."
34
  raise gr.Error(error_msg, duration=5)
35
 
36
  # Split the input SMILES string by ':' to get a list
 
106
  with gr.Column():
107
  gr.Markdown("#### Target Protein")
108
  protein_id = gr.Dropdown(
109
+ choices=ENABLED_MODELS,
110
  label="Target Protein ID",
111
  info="Select the target protein from the dropdown menu.",
112
  value="ada"