Python Example: Embedding (1)
1. Create the biocentral_api object:
from biocentral_api import BiocentralAPI
biocentral_api = BiocentralAPI().wait_until_healthy()
Python Example: Embedding (2)
2. Load data and set parameters:
from biocentral_api import CommonEmbedder
reduce = True # per-sequence embeddings
sequence_data = {"Seq1": "MMALSLALM",
"Seq2": "PRTEIN",
"Seq3": "PRT",
"Seq4": "SEQWENCE",
"Seq5": "MMPRTEINSEQWENCE",
}
embedder_name = CommonEmbedder.ProtT5
Python Example: Embedding (3)
3. Run the embedding task:
embeddings = biocentral_api.embed(
embedder_name=embedder_name,
reduce=reduce,
sequence_data=sequence_data,
use_half_precision=False).run_with_progress()
Python Example: Embedding (4)
4. Use the embedding result directly in your code:
print(embeddings["Seq1"])
embeddings.save("local_path.h5")
print(embeddings.to_dict())