Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,11 +21,10 @@ def load_pdf_and_generate_embeddings(pdf_doc, open_ai_key, relevant_pages='all')
|
|
21 |
#Create an instance of OpenAIEmbeddings, which is responsible for generating embeddings for text
|
22 |
embeddings = OpenAIEmbeddings()
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
vectordb = Chroma.from_documents(pages, embedding=embeddings)
|
29 |
|
30 |
#Finally, we create the bot using the RetrievalQA class
|
31 |
global pdf_qa
|
@@ -139,7 +138,6 @@ with gr.Blocks(css=css,theme=gr.themes.Monochrome()) as demo:
|
|
139 |
submit_query.click(answer_query,input,output)
|
140 |
|
141 |
|
142 |
-
#Forcing container to restart
|
143 |
demo.launch()
|
144 |
|
145 |
|
|
|
21 |
#Create an instance of OpenAIEmbeddings, which is responsible for generating embeddings for text
|
22 |
embeddings = OpenAIEmbeddings()
|
23 |
|
24 |
+
if relevant_pages == 'all':
|
25 |
+
pages = pages
|
26 |
+
#To create a vector store, we use the Chroma class, which takes the documents (pages in our case) and the embeddings instance
|
27 |
+
vectordb = Chroma.from_documents(pages, embedding=embeddings)
|
|
|
28 |
|
29 |
#Finally, we create the bot using the RetrievalQA class
|
30 |
global pdf_qa
|
|
|
138 |
submit_query.click(answer_query,input,output)
|
139 |
|
140 |
|
|
|
141 |
demo.launch()
|
142 |
|
143 |
|