kamau1 commited on
Commit
f18eeb7
1 Parent(s): 3691805

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
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="semaNaPDF", page_icon="📚", layout="wide",)
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
- with st.spinner("Processing"):
102
- # get pdf text
103
- if pdf is not None:
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:
 
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: