slidedeckai.helpers.icons_embeddings#
Generate and save the embeddings of a pre-defined list of icons. Compare them with keywords embeddings to find most relevant icons.
Find relevant icon file names for a list of keywords. |
|
Generate embeddings for a list of texts using a pre-trained language model. |
|
Get a list of available icons. |
|
Load precomputed embeddings and icons file names. |
|
Example usage. |
|
Generate and save the embeddings for the icon file names. |
Generate and save the embeddings of a pre-defined list of icons. Compare them with keywords embeddings to find most relevant icons.
- slidedeckai.helpers.icons_embeddings.find_icons(keywords: list[str]) list[str][source]#
Find relevant icon file names for a list of keywords.
- Parameters:
keywords – The list of one or more keywords.
- Returns:
A list of the file names relevant for each keyword.
- slidedeckai.helpers.icons_embeddings.get_embeddings(texts: str | list[str]) ndarray[source]#
Generate embeddings for a list of texts using a pre-trained language model.
- Parameters:
texts – A string or a list of strings to be converted into embeddings.
- Returns:
A NumPy array containing the embeddings for the input texts.
- Raises:
ValueError – If the input is not a string or a list of strings, or if any element in the list is not a string.
Example usage: >>> keyword = ‘neural network’ >>> file_names = [‘neural_network_icon.png’, ‘data_analysis_icon.png’, ‘machine_learning.png’] >>> keyword_embeddings = get_embeddings(keyword) >>> file_name_embeddings = get_embeddings(file_names)
- slidedeckai.helpers.icons_embeddings.get_icons_list() list[str][source]#
Get a list of available icons.
- Returns:
The icons file names.