Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
# Imports
|
2 |
import streamlit as st
|
|
|
3 |
from PyPDF2 import PdfReader
|
4 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
5 |
import os
|
@@ -45,17 +45,14 @@ Refrain from mentioning any mathematical equations, even if they are present in
|
|
45 |
Focus on the textual information available. Please provide direct quotations or references from PDF
|
46 |
to back up your response. If the answer is not found within the PDF,
|
47 |
please state "answer is not available in the context.\n\n
|
48 |
-
|
49 |
Context:\n {context}?\n
|
50 |
Question: \n{question}\n
|
51 |
-
|
52 |
Example response format:
|
53 |
- Overview: (brief summary or introduction)
|
54 |
- Key points:
|
55 |
(point 1: paragraph for main details)
|
56 |
(point 2: paragraph for main details)
|
57 |
...
|
58 |
-
|
59 |
Use a mix of paragraphs and points to effectively convey the information.
|
60 |
"""
|
61 |
|
@@ -86,7 +83,18 @@ def user_input(user_question):
|
|
86 |
|
87 |
# Streamlit UI
|
88 |
def main():
|
89 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
st.header("Chat with multiple PDFs using AI 💬")
|
91 |
|
92 |
user_question = st.text_input("Ask a Question from PDF file(s)")
|
@@ -107,4 +115,4 @@ def main():
|
|
107 |
st.success("Done ✨")
|
108 |
|
109 |
if __name__ == "__main__":
|
110 |
-
main()
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
from PyPDF2 import PdfReader
|
4 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
5 |
import os
|
|
|
45 |
Focus on the textual information available. Please provide direct quotations or references from PDF
|
46 |
to back up your response. If the answer is not found within the PDF,
|
47 |
please state "answer is not available in the context.\n\n
|
|
|
48 |
Context:\n {context}?\n
|
49 |
Question: \n{question}\n
|
|
|
50 |
Example response format:
|
51 |
- Overview: (brief summary or introduction)
|
52 |
- Key points:
|
53 |
(point 1: paragraph for main details)
|
54 |
(point 2: paragraph for main details)
|
55 |
...
|
|
|
56 |
Use a mix of paragraphs and points to effectively convey the information.
|
57 |
"""
|
58 |
|
|
|
83 |
|
84 |
# Streamlit UI
|
85 |
def main():
|
86 |
+
st.markdown(
|
87 |
+
"""
|
88 |
+
<style>
|
89 |
+
.reportview-container {
|
90 |
+
background: url('bg.jpeg') no-repeat center center fixed;
|
91 |
+
background-size: cover;
|
92 |
+
}
|
93 |
+
</style>
|
94 |
+
""",
|
95 |
+
unsafe_allow_html=True
|
96 |
+
)
|
97 |
+
|
98 |
st.header("Chat with multiple PDFs using AI 💬")
|
99 |
|
100 |
user_question = st.text_input("Ask a Question from PDF file(s)")
|
|
|
115 |
st.success("Done ✨")
|
116 |
|
117 |
if __name__ == "__main__":
|
118 |
+
main()
|