-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
36 lines (28 loc) · 1.11 KB
/
run.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
"""Script used to run the program."""
# ==============================================================================
# IMPORT PYTHON DEPENDENCIES
# ==============================================================================
from uvicorn import Config, Server
from uvicorn.supervisors import ChangeReload
# ==============================================================================
# RUN APPLICATION
# ==============================================================================
def run(host: str = "127.0.0.1", port: int = 8080) -> None:
"""
Run the Uvicorn server for debug.
Args:
host (str, optional): The host to bind. Defaults to `"127.0.0.1"`.
port (int, optional): The port to use. Defaults to `8080`.
"""
# Config the serveur.
config = Config(
"cognitivefactory.interactive_clustering_gui.app:app",
host=host,
port=port,
log_level="debug",
reload=True,
)
server = Server(config)
# Run the web app with reload option.
sock = config.bind_socket()
ChangeReload(config, target=server.run, sockets=[sock]).run()