Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,9 +29,9 @@ def extract_text_from_pdf(pdf_file):
|
|
29 |
text += page_text + "\n"
|
30 |
return text
|
31 |
|
32 |
-
# Load dataset (
|
33 |
-
def
|
34 |
-
return load_dataset('
|
35 |
|
36 |
# Store the PDF text and embeddings
|
37 |
pdf_text = ""
|
@@ -58,6 +58,9 @@ if pdf_file:
|
|
58 |
else:
|
59 |
st.warning("No extractable text found in the PDF.")
|
60 |
|
|
|
|
|
|
|
61 |
# User input for chatbot
|
62 |
user_input = st.text_input("Ask a question related to the PDF or CSV:")
|
63 |
|
@@ -81,3 +84,4 @@ if st.button("Get Response"):
|
|
81 |
except Exception as e:
|
82 |
st.error(f"Error while processing the question: {e}")
|
83 |
|
|
|
|
29 |
text += page_text + "\n"
|
30 |
return text
|
31 |
|
32 |
+
# Load dataset (using SQuAD v2 as a placeholder)
|
33 |
+
def load_squad_v2():
|
34 |
+
return load_dataset('squad_v2')
|
35 |
|
36 |
# Store the PDF text and embeddings
|
37 |
pdf_text = ""
|
|
|
58 |
else:
|
59 |
st.warning("No extractable text found in the PDF.")
|
60 |
|
61 |
+
# Load the SQuAD v2 dataset as an example for RAG retrieval
|
62 |
+
dataset = load_squad_v2()
|
63 |
+
|
64 |
# User input for chatbot
|
65 |
user_input = st.text_input("Ask a question related to the PDF or CSV:")
|
66 |
|
|
|
84 |
except Exception as e:
|
85 |
st.error(f"Error while processing the question: {e}")
|
86 |
|
87 |
+
|