sagawa commited on
Commit
5c90d58
1 Parent(s): 3f0d59c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -24
app.py CHANGED
@@ -29,31 +29,29 @@ class Config:
29
  def predict_stability(cfg, model_choice, organism_choice, pdb_file=None, sequence=None):
30
  # Check if pdb_file is provided
31
  if pdb_file:
32
- error1
33
  pdb_path = pdb_file.name # Get the path of the uploaded PDB file
34
  os.system("chmod 777 bin/foldseek")
35
  sequences = get_foldseek_seq(pdb_path)
36
- error2
37
- # if not sequences:
38
- # return "Failed to extract sequence from the PDB file."
39
- # if model_choice == "SaProt":
40
- # sequence = sequences[2]
41
- # else:
42
- # sequence = sequences[0]
43
-
44
- # if organism_choice == "Human":
45
- # cell_line = "HeLa"
46
- # else:
47
- # cell_line = "NIH3T3"
48
- # # If sequence is provided directly
49
- # if sequence:
50
- # cfg.model = f"sagawa/PLTNUM-{model_choice}-{cell_line}"
51
- # cfg.architecture = model_choice
52
- # cfg.model_path = f"sagawa/PLTNUM-{model_choice}-{cell_line}"
53
- # output = predict(cfg, sequence)
54
- # return f"Predicted Stability using {model_choice} for {organism_choice}: Example Output with sequence {output}..."
55
- # else:
56
- # return "No valid input provided."
57
 
58
 
59
  def get_foldseek_seq(pdb_path):
@@ -154,7 +152,7 @@ with gr.Blocks() as demo:
154
 
155
  predict_button.click(
156
  fn=predict_stability,
157
- inputs=[model_choice, organism_choice, pdb_file],
158
  outputs=prediction_output,
159
  )
160
 
@@ -172,7 +170,7 @@ with gr.Blocks() as demo:
172
 
173
  predict_button.click(
174
  fn=predict_stability,
175
- inputs=[model_choice, organism_choice, sequence],
176
  outputs=prediction_output,
177
  )
178
 
 
29
  def predict_stability(cfg, model_choice, organism_choice, pdb_file=None, sequence=None):
30
  # Check if pdb_file is provided
31
  if pdb_file:
 
32
  pdb_path = pdb_file.name # Get the path of the uploaded PDB file
33
  os.system("chmod 777 bin/foldseek")
34
  sequences = get_foldseek_seq(pdb_path)
35
+ if not sequences:
36
+ return "Failed to extract sequence from the PDB file."
37
+ if model_choice == "SaProt":
38
+ sequence = sequences[2]
39
+ else:
40
+ sequence = sequences[0]
41
+
42
+ if organism_choice == "Human":
43
+ cell_line = "HeLa"
44
+ else:
45
+ cell_line = "NIH3T3"
46
+ # If sequence is provided directly
47
+ if sequence:
48
+ cfg.model = f"sagawa/PLTNUM-{model_choice}-{cell_line}"
49
+ cfg.architecture = model_choice
50
+ cfg.model_path = f"sagawa/PLTNUM-{model_choice}-{cell_line}"
51
+ output = predict(cfg, sequence)
52
+ return f"Predicted Stability using {model_choice} for {organism_choice}: Example Output with sequence {output}..."
53
+ else:
54
+ return "No valid input provided."
 
55
 
56
 
57
  def get_foldseek_seq(pdb_path):
 
152
 
153
  predict_button.click(
154
  fn=predict_stability,
155
+ inputs=[Config, model_choice, organism_choice, pdb_file],
156
  outputs=prediction_output,
157
  )
158
 
 
170
 
171
  predict_button.click(
172
  fn=predict_stability,
173
+ inputs=[Config, model_choice, organism_choice, sequence],
174
  outputs=prediction_output,
175
  )
176