Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,8 +36,8 @@ def load_documents():
|
|
36 |
|
37 |
def split_text(documents: list[Document]):
|
38 |
text_splitter = RecursiveCharacterTextSplitter(
|
39 |
-
chunk_size=
|
40 |
-
chunk_overlap=
|
41 |
length_function=len,
|
42 |
add_start_index=True,
|
43 |
)
|
@@ -59,10 +59,11 @@ def save_to_chroma(chunks: list[Document]):
|
|
59 |
# Create a new DB from the documents.
|
60 |
db = Chroma.from_documents(
|
61 |
chunks,
|
62 |
-
HuggingFaceEmbeddings(model_name="BAAI/bge-
|
|
|
63 |
persist_directory=CHROMA_PATH
|
64 |
)
|
65 |
-
|
66 |
print(f"Saved {len(chunks)} chunks to {CHROMA_PATH}.")
|
67 |
|
68 |
|
|
|
36 |
|
37 |
def split_text(documents: list[Document]):
|
38 |
text_splitter = RecursiveCharacterTextSplitter(
|
39 |
+
chunk_size=1000,
|
40 |
+
chunk_overlap=200,
|
41 |
length_function=len,
|
42 |
add_start_index=True,
|
43 |
)
|
|
|
59 |
# Create a new DB from the documents.
|
60 |
db = Chroma.from_documents(
|
61 |
chunks,
|
62 |
+
HuggingFaceEmbeddings(model_name="BAAI/bge-m3"),
|
63 |
+
cache_folder="model_cache", # Укажите путь для кэша
|
64 |
persist_directory=CHROMA_PATH
|
65 |
)
|
66 |
+
|
67 |
print(f"Saved {len(chunks)} chunks to {CHROMA_PATH}.")
|
68 |
|
69 |
|