Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ import os
|
|
19 |
os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets['huggingface_token']
|
20 |
|
21 |
# Page configuration
|
22 |
-
st.set_page_config(page_title="
|
23 |
|
24 |
# Sema Translator
|
25 |
#Public_Url = os.environ["sema_url"] #endpoint
|
@@ -98,21 +98,21 @@ def main():
|
|
98 |
# upload file
|
99 |
pdf = st.file_uploader("Upload a PDF Document and ask questions to get insights", type="pdf")
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
raw_text = get_pdf_text(pdf)
|
105 |
|
106 |
-
|
107 |
-
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
# create conversation chain
|
113 |
-
st.session_state.conversation = get_conversation_chain(vectorstore)
|
114 |
-
st.info("done")
|
115 |
|
|
|
|
|
|
|
|
|
116 |
#user_question = st.text_input("Get insights into your finances ...")
|
117 |
# show user input
|
118 |
if "messages" not in st.session_state:
|
|
|
19 |
os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets['huggingface_token']
|
20 |
|
21 |
# Page configuration
|
22 |
+
st.set_page_config(page_title="SemaNaPDF", page_icon="📚",)
|
23 |
|
24 |
# Sema Translator
|
25 |
#Public_Url = os.environ["sema_url"] #endpoint
|
|
|
98 |
# upload file
|
99 |
pdf = st.file_uploader("Upload a PDF Document and ask questions to get insights", type="pdf")
|
100 |
|
101 |
+
if pdf is not None:
|
102 |
+
with st.spinner("processing"):
|
103 |
+
# get pdf text
|
104 |
raw_text = get_pdf_text(pdf)
|
105 |
|
106 |
+
# get the text chunks
|
107 |
+
text_chunks = get_text_chunks(raw_text)
|
108 |
|
109 |
+
# create vector store
|
110 |
+
vectorstore = get_vectorstore(text_chunks)
|
|
|
|
|
|
|
|
|
111 |
|
112 |
+
# create conversation chain
|
113 |
+
st.session_state.conversation = get_conversation_chain(vectorstore)
|
114 |
+
st.info("done")
|
115 |
+
|
116 |
#user_question = st.text_input("Get insights into your finances ...")
|
117 |
# show user input
|
118 |
if "messages" not in st.session_state:
|