Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -421,16 +421,14 @@ def get_trust_tip_and_suggestion():
|
|
| 421 |
|
| 422 |
|
| 423 |
|
|
|
|
| 424 |
def load_main_data_source():
|
| 425 |
try:
|
| 426 |
with open("./data_source/time_to_rethink_trust_book.md", "r") as f:
|
| 427 |
main_content = f.read()
|
| 428 |
|
| 429 |
# Split main content into chunks
|
| 430 |
-
text_splitter =
|
| 431 |
-
chunk_size=2000, # Adjust based on your model's context limit
|
| 432 |
-
chunk_overlap=200 # Ensures continuity between chunks
|
| 433 |
-
)
|
| 434 |
main_texts = text_splitter.split_text(main_content)
|
| 435 |
|
| 436 |
# Create Document objects for the main data source
|
|
@@ -443,6 +441,9 @@ def load_main_data_source():
|
|
| 443 |
|
| 444 |
|
| 445 |
|
|
|
|
|
|
|
|
|
|
| 446 |
def refresh_faiss_index():
|
| 447 |
combined_sources = load_main_data_source()
|
| 448 |
if combined_sources:
|
|
|
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
+
|
| 425 |
def load_main_data_source():
|
| 426 |
try:
|
| 427 |
with open("./data_source/time_to_rethink_trust_book.md", "r") as f:
|
| 428 |
main_content = f.read()
|
| 429 |
|
| 430 |
# Split main content into chunks
|
| 431 |
+
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
|
|
|
|
|
|
|
|
|
| 432 |
main_texts = text_splitter.split_text(main_content)
|
| 433 |
|
| 434 |
# Create Document objects for the main data source
|
|
|
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
|
| 447 |
def refresh_faiss_index():
|
| 448 |
combined_sources = load_main_data_source()
|
| 449 |
if combined_sources:
|