Tonic commited on
Commit
8c49ed2
·
1 Parent(s): 4f549e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -128,7 +128,7 @@ def embed_pdf(file, collection_name):
128
  file_content = file.read()
129
  else:
130
  # Handle the case where 'read' method is not available
131
- file_content = file.getvalue() # Assuming it's a NamedString or similar object
132
 
133
  with open(file_path, 'wb') as f:
134
  f.write(file_content)
@@ -150,7 +150,7 @@ def embed_pdf(file, collection_name):
150
 
151
  os.remove(file_path)
152
  return {"message": f"Documents embedded in Weaviate collection '{collection_name}'"}
153
-
154
  def retrieve_info(query):
155
  llm = OpenAI(temperature=0, openai_api_key=openai_api_key)
156
  qa = RetrievalQA.from_chain_type(llm, retriever=vectorstore.as_retriever())
 
128
  file_content = file.read()
129
  else:
130
  # Handle the case where 'read' method is not available
131
+ file_content = file
132
 
133
  with open(file_path, 'wb') as f:
134
  f.write(file_content)
 
150
 
151
  os.remove(file_path)
152
  return {"message": f"Documents embedded in Weaviate collection '{collection_name}'"}
153
+
154
  def retrieve_info(query):
155
  llm = OpenAI(temperature=0, openai_api_key=openai_api_key)
156
  qa = RetrievalQA.from_chain_type(llm, retriever=vectorstore.as_retriever())