Spaces:
Runtime error
Runtime error
Update app.py
Browse fileschange api key location
app.py
CHANGED
|
@@ -77,7 +77,6 @@ def get_vectorstore(text_chunks):
|
|
| 77 |
A FAISS vector store containing the embeddings of the text chunks.
|
| 78 |
|
| 79 |
"""
|
| 80 |
-
# embeddings = OpenAIEmbeddings()
|
| 81 |
model = "BAAI/bge-base-en-v1.5"
|
| 82 |
encode_kwargs = {
|
| 83 |
"normalize_embeddings": True
|
|
@@ -106,7 +105,7 @@ def get_conversation_chain(vectorstore):
|
|
| 106 |
"""
|
| 107 |
llm = HuggingFaceHub(
|
| 108 |
repo_id="mistralai/Mistral-7B-Instruct-v0.1",
|
| 109 |
-
model_kwargs={"temperature": 0.5, "max_length":
|
| 110 |
)
|
| 111 |
# llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613")
|
| 112 |
|
|
@@ -154,14 +153,6 @@ def main():
|
|
| 154 |
|
| 155 |
st.write(css, unsafe_allow_html=True)
|
| 156 |
|
| 157 |
-
# set huggingface hub token in st.text_input widget
|
| 158 |
-
# then hide the input
|
| 159 |
-
huggingface_token = st.text_input("Enter your HuggingFace Hub token", type="password")
|
| 160 |
-
#openai_api_key = st.text_input("Enter your OpenAI API key", type="password")
|
| 161 |
-
|
| 162 |
-
# set this key as an environment variable
|
| 163 |
-
os.environ["HUGGINGFACEHUB_API_TOKEN"] = huggingface_token
|
| 164 |
-
#os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 165 |
|
| 166 |
if "conversation" not in st.session_state:
|
| 167 |
st.session_state.conversation = None
|
|
@@ -174,6 +165,14 @@ def main():
|
|
| 174 |
handle_userinput(user_question)
|
| 175 |
|
| 176 |
with st.sidebar:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
st.subheader("Your documents")
|
| 178 |
pdf_docs = st.file_uploader(
|
| 179 |
"Upload your PDFs here and click on 'Process'", accept_multiple_files=True
|
|
|
|
| 77 |
A FAISS vector store containing the embeddings of the text chunks.
|
| 78 |
|
| 79 |
"""
|
|
|
|
| 80 |
model = "BAAI/bge-base-en-v1.5"
|
| 81 |
encode_kwargs = {
|
| 82 |
"normalize_embeddings": True
|
|
|
|
| 105 |
"""
|
| 106 |
llm = HuggingFaceHub(
|
| 107 |
repo_id="mistralai/Mistral-7B-Instruct-v0.1",
|
| 108 |
+
model_kwargs={"temperature": 0.5, "max_length": 1024},
|
| 109 |
)
|
| 110 |
# llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613")
|
| 111 |
|
|
|
|
| 153 |
|
| 154 |
st.write(css, unsafe_allow_html=True)
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
if "conversation" not in st.session_state:
|
| 158 |
st.session_state.conversation = None
|
|
|
|
| 165 |
handle_userinput(user_question)
|
| 166 |
|
| 167 |
with st.sidebar:
|
| 168 |
+
# set huggingface hub token in st.text_input widget
|
| 169 |
+
# then hide the input
|
| 170 |
+
huggingface_token = st.text_input("Enter your HuggingFace Hub token", type="password")
|
| 171 |
+
#openai_api_key = st.text_input("Enter your OpenAI API key", type="password")
|
| 172 |
+
|
| 173 |
+
# set this key as an environment variable
|
| 174 |
+
os.environ["HUGGINGFACEHUB_API_TOKEN"] = huggingface_token
|
| 175 |
+
#os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 176 |
st.subheader("Your documents")
|
| 177 |
pdf_docs = st.file_uploader(
|
| 178 |
"Upload your PDFs here and click on 'Process'", accept_multiple_files=True
|