Spaces:
Sleeping
Sleeping
Commit
ยท
aaeef94
1
Parent(s):
cc483a7
persistent decryption-key input
Browse files- app.py +8 -10
- modeling.py +0 -1
app.py
CHANGED
@@ -28,7 +28,6 @@ def initialize():
|
|
28 |
st.session_state.setdefault('db', None)
|
29 |
st.session_state.setdefault('results', pd.DataFrame())
|
30 |
st.session_state.setdefault('decrypt_key', None)
|
31 |
-
st.session_state.setdefault('valid_decrypt_key', False)
|
32 |
|
33 |
with open('config.yaml', 'r') as stream:
|
34 |
st.session_state['config'] = yaml.safe_load(stream)
|
@@ -75,15 +74,14 @@ def show_demo(placeholder):
|
|
75 |
|
76 |
with st.form("submission_form"):
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
)
|
87 |
|
88 |
with st.expander(label="Model", expanded=False, icon="๐ง "):
|
89 |
|
|
|
28 |
st.session_state.setdefault('db', None)
|
29 |
st.session_state.setdefault('results', pd.DataFrame())
|
30 |
st.session_state.setdefault('decrypt_key', None)
|
|
|
31 |
|
32 |
with open('config.yaml', 'r') as stream:
|
33 |
st.session_state['config'] = yaml.safe_load(stream)
|
|
|
74 |
|
75 |
with st.form("submission_form"):
|
76 |
|
77 |
+
with st.expander(label="Authentication", expanded=True, icon="๐"):
|
78 |
+
st.text_input(
|
79 |
+
label="Encryption key",
|
80 |
+
value="",
|
81 |
+
max_chars=None,
|
82 |
+
key='decrypt_key',
|
83 |
+
placeholder="A URL-safe base64-encoded 32-byte key"
|
84 |
+
)
|
|
|
85 |
|
86 |
with st.expander(label="Model", expanded=False, icon="๐ง "):
|
87 |
|
modeling.py
CHANGED
@@ -45,7 +45,6 @@ def load_model():
|
|
45 |
cipher = Fernet(st.session_state['decrypt_key'])
|
46 |
decrypted_df = cipher.decrypt(encrypted_data)
|
47 |
st.session_state['db'] = pickle.loads(decrypted_df)
|
48 |
-
st.session_state['valid_decrypt_key'] = True
|
49 |
except Exception as e:
|
50 |
st.error(body="Error: No valid encryption key!", icon="๐")
|
51 |
logging.error(e)
|
|
|
45 |
cipher = Fernet(st.session_state['decrypt_key'])
|
46 |
decrypted_df = cipher.decrypt(encrypted_data)
|
47 |
st.session_state['db'] = pickle.loads(decrypted_df)
|
|
|
48 |
except Exception as e:
|
49 |
st.error(body="Error: No valid encryption key!", icon="๐")
|
50 |
logging.error(e)
|