niting089 commited on
Commit
25f9a56
1 Parent(s): 5ff7c13

Updated app,py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -79,9 +79,10 @@ async def on_chat_start():
79
  await cl.Message(f"Processing '{pdf_file.name}'...").send()
80
 
81
  try:
82
- # Copy the uploaded file to a new location
83
- temp_file_path = f"temp_{pdf_file.name}"
84
- shutil.copy2(pdf_file.path, temp_file_path)
 
85
 
86
  # Load and process the PDF
87
  loader = PyMuPDFLoader(temp_file_path)
 
79
  await cl.Message(f"Processing '{pdf_file.name}'...").send()
80
 
81
  try:
82
+ # Save the uploaded file to a temporary location
83
+ temp_file_path = f"/tmp/{pdf_file.name}"
84
+ with open(temp_file_path, "wb") as f:
85
+ f.write(pdf_file.content)
86
 
87
  # Load and process the PDF
88
  loader = PyMuPDFLoader(temp_file_path)