import argparse | |
from copaint.gradio_ui import build_gradio_ui | |
import os | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument( | |
"-s", "--share", | |
action=argparse.BooleanOptionalAction, # enables --share / --no-share | |
default=True, | |
help="Share the app publicly (default: true)" | |
) | |
args = parser.parse_args() | |
demo = build_gradio_ui() | |
# check if /dev/shm exists | |
if os.path.exists("/dev/shm"): | |
demo.launch(share=args.share, allowed_paths=["/dev/shm"]) | |
else: | |
demo.launch(share=args.share) | |
if __name__ == "__main__": | |
main() | |