Huzaifa367 commited on
Commit
64b1361
·
verified ·
1 Parent(s): 7bba854

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -79,6 +79,9 @@ def main():
79
  # Main column for displaying extracted text and user interaction
80
  col1, col2 = st.columns([1, 2])
81
 
 
 
 
82
  if pdf_docs and col1.button("Submit"):
83
  with col1:
84
  st.spinner("Processing...")
@@ -86,14 +89,16 @@ def main():
86
  text_chunks = get_text_chunks(raw_text)
87
  get_vector_store(text_chunks, api_key)
88
  st.success("Processing Complete")
 
 
 
89
 
90
- if raw_text:
 
91
  with col2:
92
  st.subheader("Extracted Text from PDF:")
93
  st.text(raw_text)
94
- user_question = st.text_input("Ask a question from the Docs")
95
- if user_question:
96
- user_input(user_question, api_key)
97
 
98
  if __name__ == "__main__":
99
  main()
 
79
  # Main column for displaying extracted text and user interaction
80
  col1, col2 = st.columns([1, 2])
81
 
82
+ # Initialize raw_text as None initially
83
+ raw_text = None
84
+
85
  if pdf_docs and col1.button("Submit"):
86
  with col1:
87
  st.spinner("Processing...")
 
89
  text_chunks = get_text_chunks(raw_text)
90
  get_vector_store(text_chunks, api_key)
91
  st.success("Processing Complete")
92
+ user_question = st.text_input("Ask a question from the Docs")
93
+ if user_question:
94
+ user_input(user_question, api_key)
95
 
96
+ # Display extracted text and handle user interaction if raw_text is not None
97
+ if raw_text is not None:
98
  with col2:
99
  st.subheader("Extracted Text from PDF:")
100
  st.text(raw_text)
101
+
 
 
102
 
103
  if __name__ == "__main__":
104
  main()