prsdm commited on
Commit
9e536fc
1 Parent(s): dacd904

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
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 = OpenAI(temperature=0.7, openai_api_key=openai_api_key)
45
- # llm = HuggingFaceHub(
46
- # repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1",
47
- # model_kwargs={"temperature": 0.5, "max_length": 1048},
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
- openai_api_key = st.sidebar.text_input('OpenAI API Key',type="password")
79
- os.environ["OpenAI_Key"] = huggingface_token
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: