HAOUARI Noureddine
commited on
Commit
·
41dbe93
1
Parent(s):
d0341c5
better version 03
Browse files
app.py
CHANGED
@@ -66,7 +66,11 @@ step01 = "Step 01: Upload Files"
|
|
66 |
step02 = "Step 02: Edit Knowledge Base"
|
67 |
step03 = "Step 03: Split text"
|
68 |
tabs = [step01, step02, step03]
|
69 |
-
selected_tab
|
|
|
|
|
|
|
|
|
70 |
|
71 |
if "text_content" not in st.session_state:
|
72 |
st.session_state.text_content = ""
|
@@ -95,11 +99,13 @@ elif selected_tab == step01:
|
|
95 |
for uploaded_file in uploaded_files]
|
96 |
file_names = [uploaded_file.name for uploaded_file in uploaded_files]
|
97 |
|
98 |
-
if st.button('Convert
|
99 |
converting_message = st.text("Converting PDFs...")
|
100 |
converted_text = "\n".join(pdf_to_text(pdf_files_data, file_names))
|
101 |
st.session_state.text_content += converted_text
|
102 |
converting_message.empty()
|
|
|
|
|
103 |
|
104 |
elif selected_tab == step03:
|
105 |
st.subheader("Splitting Options")
|
|
|
66 |
step02 = "Step 02: Edit Knowledge Base"
|
67 |
step03 = "Step 03: Split text"
|
68 |
tabs = [step01, step02, step03]
|
69 |
+
if "selected_tab" not in st.session_state:
|
70 |
+
st.session_state.selected_tab = step01
|
71 |
+
|
72 |
+
selected_tab = st.sidebar.radio(
|
73 |
+
"Choose a tab", tabs, index=tabs.index(st.session_state.selected_tab))
|
74 |
|
75 |
if "text_content" not in st.session_state:
|
76 |
st.session_state.text_content = ""
|
|
|
99 |
for uploaded_file in uploaded_files]
|
100 |
file_names = [uploaded_file.name for uploaded_file in uploaded_files]
|
101 |
|
102 |
+
if st.button('Convert to text'):
|
103 |
converting_message = st.text("Converting PDFs...")
|
104 |
converted_text = "\n".join(pdf_to_text(pdf_files_data, file_names))
|
105 |
st.session_state.text_content += converted_text
|
106 |
converting_message.empty()
|
107 |
+
st.session_state.selected_tab = step02
|
108 |
+
st.experimental_rerun()
|
109 |
|
110 |
elif selected_tab == step03:
|
111 |
st.subheader("Splitting Options")
|