Update verifier.py
Browse files- verifier.py +11 -3
verifier.py
CHANGED
|
@@ -26,8 +26,16 @@ def verifier_page():
|
|
| 26 |
|
| 27 |
fields_to_fetch = ['filename', 'pdf_url', 'text']
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Check if a file has already been selected and displayed
|
| 30 |
-
if
|
| 31 |
# When a file is selected, clear everything and display the details only
|
| 32 |
st.empty() # Clear all content before displaying details
|
| 33 |
st.title(f"Selected File: {st.session_state.selected_file}")
|
|
@@ -57,9 +65,9 @@ def verifier_page():
|
|
| 57 |
st.session_state.selected_text = row['text']
|
| 58 |
|
| 59 |
# Clear existing content on button click
|
| 60 |
-
st.
|
| 61 |
|
| 62 |
-
if
|
| 63 |
# Process the selected file and generate AI response
|
| 64 |
pdf_path = 'VCS-Standard.pdf'
|
| 65 |
start_page = 0 # Start extracting from the first page (0-based index)
|
|
|
|
| 26 |
|
| 27 |
fields_to_fetch = ['filename', 'pdf_url', 'text']
|
| 28 |
|
| 29 |
+
# Initialize session state variables if not present
|
| 30 |
+
if 'selected_file' not in st.session_state:
|
| 31 |
+
st.session_state.selected_file = None
|
| 32 |
+
if 'selected_text' not in st.session_state:
|
| 33 |
+
st.session_state.selected_text = ""
|
| 34 |
+
if 'selected_ai' not in st.session_state:
|
| 35 |
+
st.session_state.selected_ai = ""
|
| 36 |
+
|
| 37 |
# Check if a file has already been selected and displayed
|
| 38 |
+
if st.session_state.selected_file:
|
| 39 |
# When a file is selected, clear everything and display the details only
|
| 40 |
st.empty() # Clear all content before displaying details
|
| 41 |
st.title(f"Selected File: {st.session_state.selected_file}")
|
|
|
|
| 65 |
st.session_state.selected_text = row['text']
|
| 66 |
|
| 67 |
# Clear existing content on button click
|
| 68 |
+
st.experimental_rerun()
|
| 69 |
|
| 70 |
+
if st.session_state.selected_file:
|
| 71 |
# Process the selected file and generate AI response
|
| 72 |
pdf_path = 'VCS-Standard.pdf'
|
| 73 |
start_page = 0 # Start extracting from the first page (0-based index)
|