emmas96 commited on
Commit
09b62c7
·
1 Parent(s): cad2051

fix bug in bio_embedding usage

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -99,8 +99,10 @@ def display_dti():
99
  if selected_encoder == 'SeqVec':
100
  from bio_embeddings.embed import SeqVecEmbedder
101
  encoder = SeqVecEmbedder()
102
- embedding = encoder([sequence])
103
- embedding = encoder.reduce_per_protein(embedding)
 
 
104
  #from huggingface_hub import hf_hub_download
105
  #precomputed_embs = f'{selected_encoder}_encoding.csv'
106
  #REPO_ID = "emmas96/Lenselink"
@@ -116,13 +118,17 @@ def display_dti():
116
  elif selected_encoder == 'ESM-1b':
117
  from bio_embeddings.embed import ESM1bEmbedder
118
  encoder = ESM1bEmbedder()
119
- embedding = encoder([sequence])
120
- embedding = encoder.reduce_per_protein(embedding)
 
 
121
  elif selected_encoder == 'ProtT5':
122
  from bio_embeddings.embed import ProtTransT5XLU50Embedder
123
  encoder = ProtTransT5XLU50Embedder()
124
- embedding = encoder([sequence])
125
- embedding = encoder.reduce_per_protein(embedding)
 
 
126
  else:
127
  st.write('No pre-trained version of HyperPCM is available for the chosen encoder.')
128
  embedding = None
 
99
  if selected_encoder == 'SeqVec':
100
  from bio_embeddings.embed import SeqVecEmbedder
101
  encoder = SeqVecEmbedder()
102
+ embeddings = encoder.embed_batch([sequence])
103
+ for emb in embeddings:
104
+ embedding = encoder.reduce_per_protein(emb)
105
+ break
106
  #from huggingface_hub import hf_hub_download
107
  #precomputed_embs = f'{selected_encoder}_encoding.csv'
108
  #REPO_ID = "emmas96/Lenselink"
 
118
  elif selected_encoder == 'ESM-1b':
119
  from bio_embeddings.embed import ESM1bEmbedder
120
  encoder = ESM1bEmbedder()
121
+ embeddings = encoder.embed_batch([sequence])
122
+ for emb in embeddings:
123
+ embedding = encoder.reduce_per_protein(emb)
124
+ break
125
  elif selected_encoder == 'ProtT5':
126
  from bio_embeddings.embed import ProtTransT5XLU50Embedder
127
  encoder = ProtTransT5XLU50Embedder()
128
+ embeddings = encoder.embed_batch([sequence])
129
+ for emb in embeddings:
130
+ embedding = encoder.reduce_per_protein(emb)
131
+ break
132
  else:
133
  st.write('No pre-trained version of HyperPCM is available for the chosen encoder.')
134
  embedding = None