test4good commited on
Commit
219ecde
·
verified ·
1 Parent(s): 9c2a529

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -1,11 +1,11 @@
1
  import requests
2
  from bs4 import BeautifulSoup
3
  import gradio as gr
 
4
  from langchain.chains.question_answering import load_qa_chain
5
  # from langchain.llms import HuggingFaceHub
6
  from transformers import pipeline
7
  from langchain.llms import HuggingFacePipeline
8
- from langchain.docstore.document import Document
9
  from langchain.chains.question_answering import load_qa_chain
10
  from transformers import pipeline
11
  from sentence_transformers import SentenceTransformer
@@ -179,10 +179,7 @@ def chatbot(query):
179
 
180
  # Process the most relevant chunk with QA
181
  # result_in_russian = qa_chain.run(input_documents=[{"text": most_relevant_section}], question=query_in_russian)
182
- result_in_russian = qa_chain.run(
183
- input_documents=[Document(page_content=most_relevant_section)],
184
- question=query_in_russian
185
- )
186
 
187
  # Translate answer back to the original language as best as we can
188
  final_answer = translate_answer_back(result_in_russian, query_language)
 
1
  import requests
2
  from bs4 import BeautifulSoup
3
  import gradio as gr
4
+ from langchain.docstore.document import Document
5
  from langchain.chains.question_answering import load_qa_chain
6
  # from langchain.llms import HuggingFaceHub
7
  from transformers import pipeline
8
  from langchain.llms import HuggingFacePipeline
 
9
  from langchain.chains.question_answering import load_qa_chain
10
  from transformers import pipeline
11
  from sentence_transformers import SentenceTransformer
 
179
 
180
  # Process the most relevant chunk with QA
181
  # result_in_russian = qa_chain.run(input_documents=[{"text": most_relevant_section}], question=query_in_russian)
182
+ result_in_russian = qa_chain.run(input_documents=[Document(page_content=most_relevant_section)], question=query_in_russian)
 
 
 
183
 
184
  # Translate answer back to the original language as best as we can
185
  final_answer = translate_answer_back(result_in_russian, query_language)