text-to-speech / db /load_db.py
Daryl Fung
added imgur bucket
932db78
raw
history blame
No virus
501 Bytes
from sentence_transformers import SentenceTransformer
# Connect using a MilvusClient object
from pymilvus import Collection
from db_connect import connect
#
with open('responses.txt', 'r') as file:
content = file.read()
contents = content.split('\n\n')
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
embeddings = model.encode(contents)
data = [
contents,
embeddings
]
connect()
collection = Collection("Response")
collection.insert(data)
collection.flush()