Spaces:
Running
Running
File size: 1,048 Bytes
883f80d 97e9ddc 883f80d c0abadd 883f80d 97e9ddc 883f80d 97e9ddc 883f80d c0abadd c2b6b34 97e9ddc 883f80d 97e9ddc |
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 |
import os
from argparse import ArgumentParser
from src.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=0,
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,
)
print("Current cwd:", args.cwd)
# initialize and run app
print("Launching demo...")
app = WebUI(cwd=args.cwd, share=args.share)
app.run()
if __name__ == "__main__":
main()
|