nachikethmurthy666 commited on
Commit
be06503
·
verified ·
1 Parent(s): e016dc1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -33,9 +33,7 @@ qa_chain = None
33
 
34
  def upload_pdf(file):
35
  global qa_chain
36
- with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp:
37
- tmp.write(file.read())
38
- pdf_path = tmp.name
39
  docs = load_pdf_chunks(pdf_path)
40
  qa_chain = setup_rag(docs)
41
  return "PDF uploaded and indexed!"
@@ -56,4 +54,4 @@ with gr.Blocks() as demo:
56
  upload_btn.click(upload_pdf, inputs=file, outputs=status)
57
 
58
  if __name__ == "__main__":
59
- demo.launch()
 
33
 
34
  def upload_pdf(file):
35
  global qa_chain
36
+ pdf_path = file.name
 
 
37
  docs = load_pdf_chunks(pdf_path)
38
  qa_chain = setup_rag(docs)
39
  return "PDF uploaded and indexed!"
 
54
  upload_btn.click(upload_pdf, inputs=file, outputs=status)
55
 
56
  if __name__ == "__main__":
57
+ demo.launch()