Simon Strandgaard commited on
Commit
60e8dd8
·
1 Parent(s): 5cdccba

huggingface_spaces_browserstate_secret() added

Browse files
src/huggingface_spaces/huggingface_spaces_browserstate_secret.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ PROMPT> HUGGINGFACE_SPACES_BROWSERSTATE_SECRET=hello python -m src.huggingface_spaces.huggingface_spaces_browserstate_secret
3
+ hello
4
+
5
+ PROMPT> python -m src.huggingface_spaces.huggingface_spaces_browserstate_secret
6
+ None
7
+ """
8
+ import os
9
+ from typing import Optional
10
+
11
+ def huggingface_spaces_browserstate_secret() -> Optional[str]:
12
+ """
13
+ Returns the secret key to use for encryption of the Gradio BrowserState that is stored in the browser's localStorage.
14
+ """
15
+ return os.getenv("HUGGINGFACE_SPACES_BROWSERSTATE_SECRET")
16
+
17
+ if __name__ == "__main__":
18
+ print(huggingface_spaces_browserstate_secret())