Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
@@ -31,6 +31,7 @@ def chunk_text(text, chunk_size=512):
|
|
31 |
@app.post("/get_embeding")
|
32 |
async def get_embeding(text):
|
33 |
chunks = chunk_text(text)
|
|
|
34 |
for chunk in chunks:
|
35 |
|
36 |
# Tokenize the input text
|
@@ -47,8 +48,8 @@ async def get_embeding(text):
|
|
47 |
sentence_embedding = torch.mean(embeddings, dim=1)
|
48 |
|
49 |
#print(sentence_embedding)
|
50 |
-
|
51 |
-
|
52 |
|
53 |
|
54 |
|
|
|
31 |
@app.post("/get_embeding")
|
32 |
async def get_embeding(text):
|
33 |
chunks = chunk_text(text)
|
34 |
+
all_embeddings = []
|
35 |
for chunk in chunks:
|
36 |
|
37 |
# Tokenize the input text
|
|
|
48 |
sentence_embedding = torch.mean(embeddings, dim=1)
|
49 |
|
50 |
#print(sentence_embedding)
|
51 |
+
all_embeddings.append(sentence_embedding)
|
52 |
+
return all_embeddings
|
53 |
|
54 |
|
55 |
|