Muhammad Qasim
commited on
Commit
·
c241fe7
1
Parent(s):
ec90e85
switching to huggingface
Browse files
app.py
CHANGED
|
@@ -34,15 +34,15 @@ def get_text_chunks(text):
|
|
| 34 |
|
| 35 |
|
| 36 |
def get_vectorstore(text_chunks):
|
| 37 |
-
embeddings = OpenAIEmbeddings()
|
| 38 |
-
|
| 39 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
| 40 |
return vectorstore
|
| 41 |
|
| 42 |
|
| 43 |
def get_conversation_chain(vectorstore):
|
| 44 |
-
llm = ChatOpenAI()
|
| 45 |
-
|
| 46 |
|
| 47 |
memory = ConversationBufferMemory(
|
| 48 |
memory_key='chat_history', return_messages=True)
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def get_vectorstore(text_chunks):
|
| 37 |
+
# embeddings = OpenAIEmbeddings()
|
| 38 |
+
embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
|
| 39 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
| 40 |
return vectorstore
|
| 41 |
|
| 42 |
|
| 43 |
def get_conversation_chain(vectorstore):
|
| 44 |
+
# llm = ChatOpenAI()
|
| 45 |
+
llm = HuggingFaceHub(repo_id="google/flan-t5-xxl", model_kwargs={"temperature":0.5, "max_length":512})
|
| 46 |
|
| 47 |
memory = ConversationBufferMemory(
|
| 48 |
memory_key='chat_history', return_messages=True)
|