idea123 commited on
Commit
c3a9149
·
1 Parent(s): cef9144

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,7 +3,7 @@ import nest_asyncio
3
  import gradio as gr
4
  import requests
5
  from huggingface_hub import InferenceClient
6
- from langchain.chains import RunnablePassthrough, LLMChain
7
  from langchain.retrievers import FaissRetriever
8
  from langchain.prompts import PromptTemplate
9
  from langchain.wrappers import HuggingFacePipeline
@@ -49,7 +49,7 @@ db = FAISS.from_documents(chunked_documents,
49
  retriever = db.as_retriever()
50
 
51
  # Create the RAG chain by combining the language model with the retriever
52
- rag_chain = ({"context": retriever, "question": RunnablePassthrough()} | LLMChain)
53
 
54
  # Define the generation function for the Gradio interface
55
  def generate(
 
3
  import gradio as gr
4
  import requests
5
  from huggingface_hub import InferenceClient
6
+ from langchain.chains import LLMChain
7
  from langchain.retrievers import FaissRetriever
8
  from langchain.prompts import PromptTemplate
9
  from langchain.wrappers import HuggingFacePipeline
 
49
  retriever = db.as_retriever()
50
 
51
  # Create the RAG chain by combining the language model with the retriever
52
+ rag_chain = ({"context": retriever} | LLMChain)
53
 
54
  # Define the generation function for the Gradio interface
55
  def generate(