andreped commited on
Commit
3263161
·
1 Parent(s): 4a01db9

Use singleton in streamlit app

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -1,12 +1,8 @@
1
  import streamlit as st
 
2
 
3
- from postly.clients.postly_client import PostlyClient
4
-
5
- # Initialize the PostlyClient in Streamlit's session state
6
- if "client" not in st.session_state:
7
- st.session_state.client = PostlyClient()
8
-
9
- client = st.session_state.client
10
 
11
  # Initialize user session state
12
  if "logged_in" not in st.session_state:
@@ -172,4 +168,4 @@ def main():
172
 
173
 
174
  if __name__ == "__main__":
175
- main()
 
1
  import streamlit as st
2
+ from postly.clients.singleton_client import SingletonPostlyClient
3
 
4
+ # Initialize the PostlyClient singleton
5
+ client = SingletonPostlyClient.get_instance()
 
 
 
 
 
6
 
7
  # Initialize user session state
8
  if "logged_in" not in st.session_state:
 
168
 
169
 
170
  if __name__ == "__main__":
171
+ main()