ThorbenFroehlking commited on
Commit
5ff1286
·
1 Parent(s): 09b66ec
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -232,7 +232,13 @@ def process_pdb(pdb_id_or_file, segment):
232
  sequence = "".join(seq1(res.resname) for res in protein_residues)
233
  sequence_id = [res.id[1] for res in protein_residues]
234
 
235
- scores = np.random.rand(len(sequence))
 
 
 
 
 
 
236
  normalized_scores = normalize_scores(scores)
237
 
238
  # Zip residues with scores to track the residue ID and score
 
232
  sequence = "".join(seq1(res.resname) for res in protein_residues)
233
  sequence_id = [res.id[1] for res in protein_residues]
234
 
235
+ input_ids = tokenizer(" ".join(sequence), return_tensors="pt").input_ids.to(device)
236
+ with torch.no_grad():
237
+ outputs = model(input_ids).logits.detach().cpu().numpy().squeeze()
238
+
239
+ # Calculate scores and normalize them
240
+ scores = expit(outputs[:, 1] - outputs[:, 0])
241
+
242
  normalized_scores = normalize_scores(scores)
243
 
244
  # Zip residues with scores to track the residue ID and score