Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,11 +21,11 @@ css = """
|
|
21 |
}
|
22 |
"""
|
23 |
|
24 |
-
def upload_pdf(
|
25 |
global qa_chain
|
26 |
try:
|
27 |
-
qa_chain = create_qa_chain_from_pdf(
|
28 |
-
return gr.update(visible=True), f"✅ PDF `{
|
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="
|
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)
|