fix settings
Browse files- app.py +4 -2
- solution_app.py +2 -7
app.py
CHANGED
@@ -47,14 +47,16 @@ documents = text_loader.load()
|
|
47 |
|
48 |
# 2. CREATE TEXT SPLITTER AND SPLIT DOCUMENTS
|
49 |
text_splitter = RecursiveCharacterTextSplitter(
|
50 |
-
chunk_size=1000,
|
|
|
|
|
51 |
split_documents = text_splitter.split_documents(documents)
|
52 |
|
53 |
# 3. LOAD HUGGINGFACE EMBEDDINGS
|
54 |
hf_embeddings = HuggingFaceEndpointEmbeddings(
|
55 |
model=HF_EMBED_ENDPOINT,
|
56 |
task="feature-extraction",
|
57 |
-
|
58 |
)
|
59 |
|
60 |
|
|
|
47 |
|
48 |
# 2. CREATE TEXT SPLITTER AND SPLIT DOCUMENTS
|
49 |
text_splitter = RecursiveCharacterTextSplitter(
|
50 |
+
chunk_size=1000,
|
51 |
+
chunk_overlap=30
|
52 |
+
)
|
53 |
split_documents = text_splitter.split_documents(documents)
|
54 |
|
55 |
# 3. LOAD HUGGINGFACE EMBEDDINGS
|
56 |
hf_embeddings = HuggingFaceEndpointEmbeddings(
|
57 |
model=HF_EMBED_ENDPOINT,
|
58 |
task="feature-extraction",
|
59 |
+
huggingfacehub_api_token=HF_TOKEN,
|
60 |
)
|
61 |
|
62 |
|
solution_app.py
CHANGED
@@ -78,12 +78,7 @@ async def main():
|
|
78 |
pbars = []
|
79 |
|
80 |
for i, batch in enumerate(batches):
|
81 |
-
|
82 |
-
pbar = tqdm(
|
83 |
-
total=len(batch),
|
84 |
-
desc=f"Batch {i+1}/{len(batches)}",
|
85 |
-
position=i
|
86 |
-
)
|
87 |
pbars.append(pbar)
|
88 |
|
89 |
if i == 0:
|
@@ -174,7 +169,7 @@ async def start_chat():
|
|
174 |
cl.user_session.set("lcel_rag_chain", lcel_rag_chain)
|
175 |
|
176 |
@cl.on_message
|
177 |
-
async def
|
178 |
"""
|
179 |
This function will be called every time a message is recieved from a session.
|
180 |
|
|
|
78 |
pbars = []
|
79 |
|
80 |
for i, batch in enumerate(batches):
|
81 |
+
pbar = tqdm(total=len(batch), desc=f"Batch {i+1}/{len(batches)}", position=i)
|
|
|
|
|
|
|
|
|
|
|
82 |
pbars.append(pbar)
|
83 |
|
84 |
if i == 0:
|
|
|
169 |
cl.user_session.set("lcel_rag_chain", lcel_rag_chain)
|
170 |
|
171 |
@cl.on_message
|
172 |
+
async def main(message: cl.Message):
|
173 |
"""
|
174 |
This function will be called every time a message is recieved from a session.
|
175 |
|