Skip to content

Commit 8bc6a3d

Browse files
committed
Updated example [skip ci]
1 parent e4c7359 commit 8bc6a3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/sentence_embeddings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
conn.execute('DROP TABLE IF EXISTS documents')
1111
conn.execute('CREATE TABLE documents (id bigserial PRIMARY KEY, content text, embedding vector(384))')
1212

13-
sentences = [
13+
input = [
1414
'The dog is barking',
1515
'The cat is purring',
1616
'The bear is growling'
1717
]
1818

1919
model = SentenceTransformer('all-MiniLM-L6-v2')
20-
embeddings = model.encode(sentences)
20+
embeddings = model.encode(input)
2121

22-
for content, embedding in zip(sentences, embeddings):
22+
for content, embedding in zip(input, embeddings):
2323
conn.execute('INSERT INTO documents (content, embedding) VALUES (%s, %s)', (content, embedding))
2424

2525
document_id = 1

0 commit comments

Comments
 (0)