-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheel_wrapper.py
More file actions
46 lines (33 loc) · 1.1 KB
/
eel_wrapper.py
File metadata and controls
46 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import streamlit.web.bootstrap as bootstrap
from streamlit import config
import threading
import time
import eel
def launch_browser():
#time.sleep(2)
for mode, browser_module in eel.browsers._browser_modules.items():
path = eel.browsers._browser_paths.get(mode)
if path is None:
# Don't know this browser's path, try and find it ourselves
path = browser_module.find_path()
eel.browsers._browser_paths[mode] = path
if path:
eel.browsers.open(start_pages=[""], options={
'host': 'localhost',
'port': 8501,
'mode': mode,
'cmdline_args': [],
'app_mode': True } )
break
print("Browser opened")
def run_streamlit():
# Set the default port if needed
config.set_option("server.port", 8501)
config.set_option("server.headless", True)
# Run Streamlit app
bootstrap.run("streamlit_reflector.py", args=[], flag_options={}, is_hello=False)
def main():
launch_browser()
run_streamlit()
if __name__ == "__main__":
main()