Noobian commited on
Commit
8022309
·
1 Parent(s): 9271044

update - hugging face models instead of open ai

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -31,15 +31,15 @@ def get_text_chunks(text):
31
 
32
 
33
  def get_vectorstore(text_chunks):
34
- embeddings = OpenAIEmbeddings()
35
- # embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
36
  vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
37
  return vectorstore
38
 
39
 
40
  def get_conversation_chain(vectorstore):
41
- llm = ChatOpenAI()
42
- # llm = HuggingFaceHub(repo_id="google/flan-t5-xxl", model_kwargs={"temperature":0.5, "max_length":512})
43
 
44
  memory = ConversationBufferMemory(
45
  memory_key='chat_history', return_messages=True)
 
31
 
32
 
33
  def get_vectorstore(text_chunks):
34
+ #embeddings = OpenAIEmbeddings()
35
+ embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
36
  vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
37
  return vectorstore
38
 
39
 
40
  def get_conversation_chain(vectorstore):
41
+ #llm = ChatOpenAI()
42
+ llm = HuggingFaceHub(repo_id="google/flan-t5-xxl", model_kwargs={"temperature":0.5, "max_length":512})
43
 
44
  memory = ConversationBufferMemory(
45
  memory_key='chat_history', return_messages=True)