Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,11 +58,17 @@ def get_text_chunks(text):
|
|
| 58 |
|
| 59 |
def get_vectorstore(text_chunks):
|
| 60 |
# embeddings = OpenAIEmbeddings()
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
|
|
|
|
|
|
| 63 |
return vectorstore
|
| 64 |
|
| 65 |
-
|
| 66 |
|
| 67 |
def get_conversation_chain(vectorstore):
|
| 68 |
llm = OpenAI()
|
|
@@ -91,8 +97,6 @@ def handle_userinput(user_question):
|
|
| 91 |
st.write(bot_template.replace("{{MSG}}", message.content), unsafe_allow_html=True)
|
| 92 |
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
def main():
|
| 97 |
load_dotenv()
|
| 98 |
st.set_page_config(page_title="Chat with multiple law journal PDFs",
|
|
|
|
| 58 |
|
| 59 |
def get_vectorstore(text_chunks):
|
| 60 |
# embeddings = OpenAIEmbeddings()
|
| 61 |
+
model_name = "hkunlp/instructor-xl"
|
| 62 |
+
logger.info(f"Loading {model_name}")
|
| 63 |
+
embeddings = HuggingFaceInstructEmbeddings(model_name=model_name)
|
| 64 |
+
logger.info(f"Done loading {model_name}")
|
| 65 |
+
|
| 66 |
+
logger.info(f"Doing vectorstore FAISS.from_texts(texts=text_chunks, embedding=embeddings)")
|
| 67 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
| 68 |
+
logger.info(f"Done vectorstore FAISS.from_texts(texts=text_chunks, embedding=embeddings)")
|
| 69 |
+
|
| 70 |
return vectorstore
|
| 71 |
|
|
|
|
| 72 |
|
| 73 |
def get_conversation_chain(vectorstore):
|
| 74 |
llm = OpenAI()
|
|
|
|
| 97 |
st.write(bot_template.replace("{{MSG}}", message.content), unsafe_allow_html=True)
|
| 98 |
|
| 99 |
|
|
|
|
|
|
|
| 100 |
def main():
|
| 101 |
load_dotenv()
|
| 102 |
st.set_page_config(page_title="Chat with multiple law journal PDFs",
|