Created
July 18, 2025 04:37
-
-
Save igomez10/e62b04b048c2b07c98000bcfea6e4e6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # alias vectorize='/opt/anaconda3/bin/python ~/hackathon-cloduflare/mcp-server-demo/encode.py' | |
| import sys | |
| from sentence_transformers import SentenceTransformer | |
| # Load a pre-trained model | |
| model = SentenceTransformer('all-MiniLM-L6-v2') | |
| # Your input text | |
| if len(sys.argv) < 2: | |
| print("Usage: python encode.py <text>") | |
| sys.exit(1) | |
| text = sys.argv[1] | |
| # Generate the embedding | |
| vector = model.encode(text) | |
| # join the vector elements into a string for better readability | |
| vector = ', '.join(map(str, vector)) | |
| vector = f"[{vector}]" | |
| # Print the vector | |
| print(vector) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment