wangjin2000 commited on
Commit
287064c
·
verified ·
1 Parent(s): 4e5ecd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -244,7 +244,7 @@ def generate_peptide_for_single_sequence(model, tokenizer, protein_seq, peptide_
244
  return binders_with_ppl_plddt
245
 
246
  # Predict peptide binder with finetuned model
247
- def predict_peptide(base_model_path, finetuned_model_path, input_seqs, peptide_length=15, num_binders=4, top_k=3, plddt_iptm_yes="no"):
248
  # Load the model
249
  loaded_model = AutoModelForMaskedLM.from_pretrained(finetuned_model_path) #.to(device) inference use cpu
250
 
@@ -254,6 +254,8 @@ def predict_peptide(base_model_path, finetuned_model_path, input_seqs, peptide_l
254
  # Tokenization
255
  tokenizer = AutoTokenizer.from_pretrained(base_model_path)
256
 
 
 
257
  if isinstance(input_seqs, str): # Single sequence
258
  binders = generate_peptide_for_single_sequence(loaded_model, tokenizer, input_seqs, peptide_length, top_k, num_binders, plddt_iptm_yes)
259
  results_df = pd.DataFrame(binders, columns=['Binder', 'PPL', 'pLDDT', 'iPTM'])
 
244
  return binders_with_ppl_plddt
245
 
246
  # Predict peptide binder with finetuned model
247
+ def predict_peptide(base_model_path, finetuned_model_path, input_seqs, peptide_length=15, num_binders=4, plddt_iptm_yes="no"):
248
  # Load the model
249
  loaded_model = AutoModelForMaskedLM.from_pretrained(finetuned_model_path) #.to(device) inference use cpu
250
 
 
254
  # Tokenization
255
  tokenizer = AutoTokenizer.from_pretrained(base_model_path)
256
 
257
+ # set top_k mutations for each AA position
258
+ top_k=3
259
  if isinstance(input_seqs, str): # Single sequence
260
  binders = generate_peptide_for_single_sequence(loaded_model, tokenizer, input_seqs, peptide_length, top_k, num_binders, plddt_iptm_yes)
261
  results_df = pd.DataFrame(binders, columns=['Binder', 'PPL', 'pLDDT', 'iPTM'])