Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
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
|
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(
|