botezx's picture
Grok Bot
FlagTLDR 0.5.0 (snapshot of local f98bb37)
043267b
Raw History Blame Contribute Delete
979 Bytes
from __future__ import annotations
import argparse
def main() -> None:
ap = argparse.ArgumentParser(prog="xaddons-classifier")
sub = ap.add_subparsers(dest="cmd", required=True)
s = sub.add_parser("serve", help="run the local HTTP service for the extension")
s.add_argument("--backend", choices=["rules", "basal", "embed"], default="rules")
s.add_argument("--basal-url", default="http://127.0.0.1:8000")
s.add_argument("--embed-model", default=None)
s.add_argument("--host", default="127.0.0.1")
s.add_argument("--port", type=int, default=8765)
a = ap.parse_args()
import uvicorn
from .backends import get_backend
from .server import create_app
kw = {}
if a.backend == "basal":
kw["url"] = a.basal_url
if a.backend == "embed" and a.embed_model:
kw["model"] = a.embed_model
uvicorn.run(create_app(get_backend(a.backend, **kw)), host=a.host, port=a.port)
if __name__ == "__main__":
main()