Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,11 +37,6 @@ def preprocess_text(text):
|
|
| 37 |
if chunk != "":
|
| 38 |
cleaned_chunks.append(chunk)
|
| 39 |
|
| 40 |
-
# Print cleaned_chunks
|
| 41 |
-
print(cleaned_chunks)
|
| 42 |
-
# Print the length of cleaned_chunks
|
| 43 |
-
print(len(cleaned_chunks))
|
| 44 |
-
|
| 45 |
# Return the cleaned_chunks
|
| 46 |
return cleaned_chunks
|
| 47 |
|
|
@@ -56,16 +51,8 @@ model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
| 56 |
|
| 57 |
def create_embeddings(text_chunks):
|
| 58 |
# Convert each text chunk into a vector embedding and store as a tensor
|
| 59 |
-
chunk_embeddings = model.encode(
|
| 60 |
-
|
| 61 |
-
# Print the chunk embeddings
|
| 62 |
-
print(chunk_embeddings)
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
# Print the shape of chunk_embeddings
|
| 66 |
-
print(chunk_embeddings.shape)
|
| 67 |
-
|
| 68 |
-
|
| 69 |
# Return the chunk_embeddings
|
| 70 |
return chunk_embeddings
|
| 71 |
|
|
|
|
| 37 |
if chunk != "":
|
| 38 |
cleaned_chunks.append(chunk)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
# Return the cleaned_chunks
|
| 41 |
return cleaned_chunks
|
| 42 |
|
|
|
|
| 51 |
|
| 52 |
def create_embeddings(text_chunks):
|
| 53 |
# Convert each text chunk into a vector embedding and store as a tensor
|
| 54 |
+
chunk_embeddings = model.encode(text_chunks, convert_to_tensor=True) # Replace ... with the text_chunks list
|
| 55 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
# Return the chunk_embeddings
|
| 57 |
return chunk_embeddings
|
| 58 |
|