| ```CODE: | |
| labels = ["Billing Issue", "Technical Support", "Sales Inquiry"] | |
| sentence = [ | |
| "Excuse me, the app freezes on the login screen. It won't work even when I try to reset my password.", | |
| "I would like to inquire about your enterprise plan pricing and features for a team of 50 people.", | |
| ] | |
| # Calculate embeddings by calling model.encode() | |
| label_embeddings = model.encode(labels, prompt_name="Classification") | |
| embeddings = model.encode(sentence, prompt_name="Classification") | |
| # Calculate the embedding similarities | |
| similarities = model.similarity(embeddings, label_embeddings) | |
| print(similarities) | |
| idx = similarities.argmax(1) | |
| print(idx) | |
| for example in sentence: | |
| print("πββοΈ", example, "-> π€", labels[idx[sentence.index(example)]]) | |
| ``` | |
| ERROR: | |
| Traceback (most recent call last): | |
| File "/tmp/google_embeddinggemma-300m_69QHTnB.py", line 22, in <module> | |
| label_embeddings = model.encode(labels, prompt_name="Classification") | |
| ^^^^^ | |
| NameError: name 'model' is not defined | |