Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,6 @@ from langchain.memory import ConversationBufferMemory
|
|
9 |
from langchain.chains import ConversationalRetrievalChain
|
10 |
from htmlTemplates import css, bot_template, user_template
|
11 |
from langchain.llms import HuggingFaceHub
|
12 |
-
from langchain.llms import OpenAI
|
13 |
|
14 |
def get_pdf_text(pdf_docs):
|
15 |
text = ""
|
@@ -41,11 +40,10 @@ def get_vectorstore(text_chunks):
|
|
41 |
|
42 |
|
43 |
def get_conversation_chain(vectorstore):
|
44 |
-
llm =
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
# )
|
49 |
|
50 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
51 |
conversation_chain = ConversationalRetrievalChain.from_llm(
|
@@ -75,10 +73,8 @@ def main():
|
|
75 |
|
76 |
st.write(css, unsafe_allow_html=True)
|
77 |
|
78 |
-
|
79 |
-
os.environ["
|
80 |
-
#huggingface_token = st.text_input("Enter your HuggingFace Hub token", type="password")
|
81 |
-
#os.environ["HUGGINGFACEHUB_API_TOKEN"] = huggingface_token
|
82 |
|
83 |
|
84 |
if "conversation" not in st.session_state:
|
|
|
9 |
from langchain.chains import ConversationalRetrievalChain
|
10 |
from htmlTemplates import css, bot_template, user_template
|
11 |
from langchain.llms import HuggingFaceHub
|
|
|
12 |
|
13 |
def get_pdf_text(pdf_docs):
|
14 |
text = ""
|
|
|
40 |
|
41 |
|
42 |
def get_conversation_chain(vectorstore):
|
43 |
+
llm = HuggingFaceHub(
|
44 |
+
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
45 |
+
model_kwargs={"temperature": 0.5, "max_length": 1048},
|
46 |
+
)
|
|
|
47 |
|
48 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
49 |
conversation_chain = ConversationalRetrievalChain.from_llm(
|
|
|
73 |
|
74 |
st.write(css, unsafe_allow_html=True)
|
75 |
|
76 |
+
huggingface_token = st.text_input("Enter your HuggingFace Hub token", type="password")
|
77 |
+
os.environ["HUGGINGFACEHUB_API_TOKEN"] = huggingface_token
|
|
|
|
|
78 |
|
79 |
|
80 |
if "conversation" not in st.session_state:
|