midrees2806 commited on
Commit
ac1bdd0
·
verified ·
1 Parent(s): f8774a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -21,11 +21,11 @@ css = """
21
  }
22
  """
23
 
24
- def upload_pdf(pdf_file):
25
  global qa_chain
26
  try:
27
- qa_chain = create_qa_chain_from_pdf(pdf_file.name)
28
- return gr.update(visible=True), f"✅ PDF `{pdf_file.name}` loaded successfully!"
29
  except Exception as e:
30
  return gr.update(visible=False), f"❌ Error: {e}"
31
 
@@ -48,7 +48,7 @@ def create_interface():
48
  <p style='text-align: center;'>Upload a university prospectus or document and ask anything!</p>
49
  """)
50
 
51
- pdf_input = gr.File(label="Upload PDF", type="file", file_types=[".pdf"])
52
  status = gr.Markdown()
53
 
54
  chatbot = gr.Chatbot(elem_id="chatbot", visible=False)
 
21
  }
22
  """
23
 
24
+ def upload_pdf(pdf_file_path):
25
  global qa_chain
26
  try:
27
+ qa_chain = create_qa_chain_from_pdf(pdf_file_path)
28
+ return gr.update(visible=True), f"✅ PDF `{pdf_file_path.split('/')[-1]}` loaded successfully!"
29
  except Exception as e:
30
  return gr.update(visible=False), f"❌ Error: {e}"
31
 
 
48
  <p style='text-align: center;'>Upload a university prospectus or document and ask anything!</p>
49
  """)
50
 
51
+ pdf_input = gr.File(label="Upload PDF", type="filepath", file_types=[".pdf"])
52
  status = gr.Markdown()
53
 
54
  chatbot = gr.Chatbot(elem_id="chatbot", visible=False)