Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
3 |
from langchain_community.vectorstores.faiss import FAISS
|
4 |
from langchain.chains import RetrievalQA
|
5 |
|
@@ -9,8 +10,11 @@ vector_store = FAISS.load_local("db.index", embeddings=None, allow_dangerous_des
|
|
9 |
# Load the model using InferenceClient
|
10 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
11 |
|
|
|
|
|
|
|
12 |
# Initialize the RetrievalQA chain
|
13 |
-
qa = RetrievalQA.from_chain_type(
|
14 |
|
15 |
def respond(
|
16 |
message,
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
from langchain.llms import HuggingFaceInferenceClient
|
4 |
from langchain_community.vectorstores.faiss import FAISS
|
5 |
from langchain.chains import RetrievalQA
|
6 |
|
|
|
10 |
# Load the model using InferenceClient
|
11 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
12 |
|
13 |
+
# Create an LLM object from the InferenceClient
|
14 |
+
llm = HuggingFaceInferenceClient(client)
|
15 |
+
|
16 |
# Initialize the RetrievalQA chain
|
17 |
+
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=vector_store.as_retriever())
|
18 |
|
19 |
def respond(
|
20 |
message,
|