Spaces:
Sleeping
Sleeping
added delay for session state
Browse files- multi_env_compare.py +10 -3
multi_env_compare.py
CHANGED
@@ -3,6 +3,7 @@ import streamlit as st
|
|
3 |
import numpy as np
|
4 |
from pre import preprocess_uploaded_file
|
5 |
from difflib import SequenceMatcher
|
|
|
6 |
|
7 |
def similar(a, b, threshold=0.9):
|
8 |
return SequenceMatcher(None, a, b).ratio() > threshold
|
@@ -26,11 +27,17 @@ def perform_multi_env_analysis(uploaded_dataframes):
|
|
26 |
selected_functional_areas = st.multiselect(
|
27 |
"Select functional areas",
|
28 |
unique_areas,
|
29 |
-
default=st.session_state.selected_functional_areas
|
|
|
30 |
)
|
31 |
|
32 |
-
#
|
33 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
if "All" in selected_functional_areas:
|
36 |
selected_functional_areas = combined_data['Functional area'].unique()
|
|
|
3 |
import numpy as np
|
4 |
from pre import preprocess_uploaded_file
|
5 |
from difflib import SequenceMatcher
|
6 |
+
import time
|
7 |
|
8 |
def similar(a, b, threshold=0.9):
|
9 |
return SequenceMatcher(None, a, b).ratio() > threshold
|
|
|
27 |
selected_functional_areas = st.multiselect(
|
28 |
"Select functional areas",
|
29 |
unique_areas,
|
30 |
+
default=st.session_state.selected_functional_areas,
|
31 |
+
key="functional_areas_multiselect"
|
32 |
)
|
33 |
|
34 |
+
# Add a button to confirm the selection
|
35 |
+
if st.button("Confirm Functional Area Selection"):
|
36 |
+
# Update session state with the new selection
|
37 |
+
st.session_state.selected_functional_areas = selected_functional_areas
|
38 |
+
st.success("Functional area selection updated!")
|
39 |
+
time.sleep(0.5) # Add a small delay for better user experience
|
40 |
+
st.rerun() # Rerun the app to reflect the changes
|
41 |
|
42 |
if "All" in selected_functional_areas:
|
43 |
selected_functional_areas = combined_data['Functional area'].unique()
|