Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ qdrant = Qdrant.from_documents(
|
|
| 40 |
)
|
| 41 |
retriever = qdrant.as_retriever()
|
| 42 |
qna = RetrievalQA.from_chain_type(
|
| 43 |
-
llm=HuggingFaceHub(repo_id="
|
| 44 |
huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"]),
|
| 45 |
chain_type="stuff",
|
| 46 |
retriever=retriever
|
|
@@ -49,10 +49,6 @@ def chatbot(question, chat_history):
|
|
| 49 |
response = chain.run(question)
|
| 50 |
retrieval_result = qna(question)
|
| 51 |
retrieval_answer = retrieval_result['result']
|
| 52 |
-
# if retrival_answer.strip():
|
| 53 |
-
# combined_response=f"Based on the information available:\n{retrieval_answer}"
|
| 54 |
-
# else:
|
| 55 |
-
# combined_response=f"Response through LLM:\n{response}"
|
| 56 |
combined_response = f"Based on the information available:\n{retrieval_answer}\n Response through LLM:\n{response}"
|
| 57 |
return combined_response
|
| 58 |
demo = gr.ChatInterface(
|
|
|
|
| 40 |
)
|
| 41 |
retriever = qdrant.as_retriever()
|
| 42 |
qna = RetrievalQA.from_chain_type(
|
| 43 |
+
llm=HuggingFaceHub(repo_id="google/flan-t5-large", model_kwargs={"temperature": 0.9, "max_length": 512},
|
| 44 |
huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"]),
|
| 45 |
chain_type="stuff",
|
| 46 |
retriever=retriever
|
|
|
|
| 49 |
response = chain.run(question)
|
| 50 |
retrieval_result = qna(question)
|
| 51 |
retrieval_answer = retrieval_result['result']
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
combined_response = f"Based on the information available:\n{retrieval_answer}\n Response through LLM:\n{response}"
|
| 53 |
return combined_response
|
| 54 |
demo = gr.ChatInterface(
|