File size: 1,016 Bytes
6b70d16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
from argparse import ArgumentParser

from AeroPath.gui import WebUI


def main():
    parser = ArgumentParser()
    parser.add_argument(
        "--cwd",
        type=str,
        default="/home/user/app/",
        help="Set current working directory (path to app.py).",
    )
    parser.add_argument(
        "--share",
        type=int,
        default=1,
        help="Whether to enable the app to be accessible online"
        "-> setups a public link which requires internet access.",
    )
    args = parser.parse_args()

    print("Current working directory:", args.cwd)

    if not os.path.exists(args.cwd):
        raise ValueError("Chosen 'cwd' is not a valid path!")
    if args.share not in [0, 1]:
        raise ValueError(
            "The 'share' argument can only be set to 0 or 1, but was:",
            args.share,
        )

    # initialize and run app
    print("Launching demo...")
    app = WebUI(cwd=args.cwd, share=args.share)
    app.run()


if __name__ == "__main__":
    main()