Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,8 +39,8 @@ def create_qa_system():
|
|
| 39 |
raise ValueError("📚 No study materials found")
|
| 40 |
|
| 41 |
text_splitter = CharacterTextSplitter(
|
| 42 |
-
chunk_size=
|
| 43 |
-
chunk_overlap=
|
| 44 |
separator="\n\n"
|
| 45 |
)
|
| 46 |
texts = text_splitter.split_documents(documents)
|
|
@@ -59,7 +59,7 @@ def create_qa_system():
|
|
| 59 |
"text2text-generation",
|
| 60 |
model="google/flan-t5-large",
|
| 61 |
tokenizer=tokenizer,
|
| 62 |
-
max_length=
|
| 63 |
temperature=0.7,
|
| 64 |
do_sample=True,
|
| 65 |
top_k=50,
|
|
@@ -75,7 +75,7 @@ def create_qa_system():
|
|
| 75 |
|
| 76 |
return RetrievalQA.from_llm(
|
| 77 |
llm=HuggingFacePipeline(pipeline=pipe),
|
| 78 |
-
retriever=db.as_retriever(search_kwargs={"k":
|
| 79 |
return_source_documents=True
|
| 80 |
)
|
| 81 |
except Exception as e:
|
|
|
|
| 39 |
raise ValueError("📚 No study materials found")
|
| 40 |
|
| 41 |
text_splitter = CharacterTextSplitter(
|
| 42 |
+
chunk_size=500,
|
| 43 |
+
chunk_overlap=100,
|
| 44 |
separator="\n\n"
|
| 45 |
)
|
| 46 |
texts = text_splitter.split_documents(documents)
|
|
|
|
| 59 |
"text2text-generation",
|
| 60 |
model="google/flan-t5-large",
|
| 61 |
tokenizer=tokenizer,
|
| 62 |
+
max_length=200,
|
| 63 |
temperature=0.7,
|
| 64 |
do_sample=True,
|
| 65 |
top_k=50,
|
|
|
|
| 75 |
|
| 76 |
return RetrievalQA.from_llm(
|
| 77 |
llm=HuggingFacePipeline(pipeline=pipe),
|
| 78 |
+
retriever=db.as_retriever(search_kwargs={"k": 2}),
|
| 79 |
return_source_documents=True
|
| 80 |
)
|
| 81 |
except Exception as e:
|