-
Notifications
You must be signed in to change notification settings - Fork 22
/
gui.py
52 lines (37 loc) · 1.27 KB
/
gui.py
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
47
48
49
50
51
52
#!python
import os
def run(port=10077):
print(f"Starting PeptDeep Web Server on port {port} ...")
_this_file = __file__
_this_directory = os.path.dirname(_this_file)
file_path = os.path.join(_this_directory, "webui", "main_ui.py")
HOME = os.path.expanduser("~")
ST_PATH = os.path.join(HOME, ".streamlit")
if not os.path.isdir(ST_PATH):
os.mkdir(ST_PATH)
# Check if streamlit credentials exists
ST_CREDENTIALS = os.path.join(ST_PATH, "credentials.toml")
if not os.path.isfile(ST_CREDENTIALS):
with open(ST_CREDENTIALS, "w") as file:
file.write("[general]\n")
file.write('\nemail = ""')
import sys
from streamlit.web import cli as stcli
theme = []
theme.append("--theme.backgroundColor=#FFFFFF")
theme.append("--theme.secondaryBackgroundColor=#f0f2f6")
theme.append("--theme.textColor=#262730")
theme.append("--theme.font=sans serif")
theme.append("--theme.primaryColor=#18212b")
args = [
"streamlit",
"run",
file_path,
"--global.developmentMode=false",
f"--server.port={port}",
"--browser.gatherUsageStats=False",
"--logger.level=error",
]
args.extend(theme)
sys.argv = args
sys.exit(stcli.main())