Spaces:
Running
Running
Chandranshu Jain
commited on
Commit
•
528fe2d
1
Parent(s):
3096731
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ This chatbot is built using the Retrieval-Augmented Generation (RAG) framework,
|
|
22 |
|
23 |
Follow these simple steps to interact with the chatbot:
|
24 |
|
25 |
-
1. **Upload Your Documents**: The system accepts
|
26 |
|
27 |
2. **Ask a Question**: After processing the documents, ask any question related to the content of your uploaded documents for a precise answer.
|
28 |
""")
|
@@ -70,7 +70,7 @@ def get_conversational_chain():
|
|
70 |
def embedding(chunk,query):
|
71 |
embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
|
72 |
db = Chroma.from_documents(chunk,embeddings, persist_directory="./chroma_db")
|
73 |
-
docs =
|
74 |
chain = get_conversational_chain()
|
75 |
response = chain({"input_documents": docs, "question": query}, return_only_outputs=True)
|
76 |
st.write("Reply: ", response["output_text"])
|
@@ -81,7 +81,7 @@ def embedding(chunk,query):
|
|
81 |
def main():
|
82 |
st.header("Chat with your pdf💁")
|
83 |
st.title("Menu:")
|
84 |
-
pdf_docs = st.file_uploader("Upload your PDF
|
85 |
query = st.text_input("Ask a Question from the PDF Files", key="query")
|
86 |
if st.button("Submit & Process", key="process_button"):
|
87 |
with st.spinner("Processing..."):
|
|
|
22 |
|
23 |
Follow these simple steps to interact with the chatbot:
|
24 |
|
25 |
+
1. **Upload Your Documents**: The system accepts a PDF file at one time, analyzing the content to provide comprehensive insights.
|
26 |
|
27 |
2. **Ask a Question**: After processing the documents, ask any question related to the content of your uploaded documents for a precise answer.
|
28 |
""")
|
|
|
70 |
def embedding(chunk,query):
|
71 |
embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
|
72 |
db = Chroma.from_documents(chunk,embeddings, persist_directory="./chroma_db")
|
73 |
+
docs = db.similarity_search(query)
|
74 |
chain = get_conversational_chain()
|
75 |
response = chain({"input_documents": docs, "question": query}, return_only_outputs=True)
|
76 |
st.write("Reply: ", response["output_text"])
|
|
|
81 |
def main():
|
82 |
st.header("Chat with your pdf💁")
|
83 |
st.title("Menu:")
|
84 |
+
pdf_docs = st.file_uploader("Upload your PDF File and Click on the Submit & Process Button", accept_multiple_files=False, key="pdf_uploader")
|
85 |
query = st.text_input("Ask a Question from the PDF Files", key="query")
|
86 |
if st.button("Submit & Process", key="process_button"):
|
87 |
with st.spinner("Processing..."):
|