Download taskweaver/cli/web.py from TRaw/tskwvr: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/spaces/TRaw/tskwvr/resolve/main/taskweaver/cli/web.py
- Command line
-
hf download hf://spaces/TRaw/tskwvr/taskweaver/cli/web.py
-
curl -L -o web.py https://huggingface.co/spaces/TRaw/tskwvr/resolve/main/taskweaver/cli/web.py
1.35 kB
| import click | |
| from taskweaver.cli.util import require_workspace | |
| def web(host: str, port: int, debug: bool, open: bool): | |
| """Start TaskWeaver web server""" | |
| from taskweaver.chat.web import start_web_service | |
| if not debug: | |
| # debug mode will restart app iteratively, skip the plugin listing | |
| # display_enabled_examples_plugins() | |
| pass | |
| def post_app_start(): | |
| if open: | |
| click.secho("launching web browser...", fg="green") | |
| open_url = f"http://{'localhost' if host == '0.0.0.0' else host}:{port}" | |
| click.launch(open_url) | |
| start_web_service( | |
| host, | |
| port, | |
| is_debug=debug, | |
| post_app_start=post_app_start if open else None, | |
| ) | |