sepidnes commited on
Commit
48a6f56
·
verified ·
1 Parent(s): 7c3d29b

Update backend/main.py

Browse files
Files changed (1) hide show
  1. backend/main.py +2 -0
backend/main.py CHANGED
@@ -99,6 +99,7 @@ async def upload_file(file: UploadFile = File(...)):
99
  with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as temp_file:
100
  # Copy the uploaded file content to the temporary file
101
  content = await file.read()
 
102
  with open(temp_file.name, "wb") as f:
103
  f.write(content)
104
 
@@ -110,6 +111,7 @@ async def upload_file(file: UploadFile = File(...)):
110
  # Create a vector store
111
  vector_db = VectorDatabase()
112
  vector_db = await vector_db.abuild_from_list(texts)
 
113
 
114
  return {"message": f"File {file.filename} processed successfully", "chunks": len(texts)}
115
  finally:
 
99
  with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as temp_file:
100
  # Copy the uploaded file content to the temporary file
101
  content = await file.read()
102
+ print(f"File read complete. Size: {len(contents)} bytes")
103
  with open(temp_file.name, "wb") as f:
104
  f.write(content)
105
 
 
111
  # Create a vector store
112
  vector_db = VectorDatabase()
113
  vector_db = await vector_db.abuild_from_list(texts)
114
+ print("Document processing complete")
115
 
116
  return {"message": f"File {file.filename} processed successfully", "chunks": len(texts)}
117
  finally: