Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def get_conversational_chain():
|
|
38 |
prompt_template = """Answer the question concisely, focusing on the most relevant and important details from the PDF context. Refrain from mentioning any mathematical equations, even if they are present in provided context. Focus on the textual information available. Please provide direct quotations or references from PDF to back up your response. If the answer is not found within the PDF, please state "answer is not available in the context."\n\nContext:\n {context}?\nQuestion: \n{question}\nExample response format:Overview: (brief summary or introduction)Key points: (point 1: paragraph for key details)(point 2: paragraph for key details)...Use a mix of paragraphs and points to effectively convey the information."""
|
39 |
|
40 |
# Adjust temperature parameter to lower value to reduce model creativity & focus on factual accuracy
|
41 |
-
model = HuggingFaceHub(repo_id="google/flan-t5-xl", model_kwargs={"temperature": 0.2, "max_length": 100}, token=os.environ['HUGGINGFACEHUB_API_TOKEN'])
|
42 |
prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
|
43 |
chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
|
44 |
return chain
|
|
|
38 |
prompt_template = """Answer the question concisely, focusing on the most relevant and important details from the PDF context. Refrain from mentioning any mathematical equations, even if they are present in provided context. Focus on the textual information available. Please provide direct quotations or references from PDF to back up your response. If the answer is not found within the PDF, please state "answer is not available in the context."\n\nContext:\n {context}?\nQuestion: \n{question}\nExample response format:Overview: (brief summary or introduction)Key points: (point 1: paragraph for key details)(point 2: paragraph for key details)...Use a mix of paragraphs and points to effectively convey the information."""
|
39 |
|
40 |
# Adjust temperature parameter to lower value to reduce model creativity & focus on factual accuracy
|
41 |
+
model = HuggingFaceHub(repo_id="google/flan-t5-xl", model_kwargs={"temperature": 0.2, "max_length": 100}, token=os.environ['HUGGINGFACEHUB_API_TOKEN'])
|
42 |
prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
|
43 |
chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
|
44 |
return chain
|