Initial release
This commit is contained in:
parent
9e3f7b8a93
commit
cd6036eff4
11 changed files with 670 additions and 2 deletions
21
api-server.py
Normal file
21
api-server.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2023 Julian Müller (ChaoticByte)
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from os import environ
|
||||
|
||||
import uvicorn
|
||||
|
||||
if __name__ == "__main__":
|
||||
# CLI
|
||||
ap = ArgumentParser()
|
||||
ap.add_argument("-m", "--model", help="Filepath to the model", type=str, required=True)
|
||||
ap.add_argument("--host", help="Address to listen on (default: localhost)", type=str, default="localhost")
|
||||
ap.add_argument("--port", help="Port to listen on (default: 7331)", type=int, default=7331)
|
||||
args = ap.parse_args()
|
||||
# Set environment variable before importing api server
|
||||
environ["MODEL"] = args.model
|
||||
# Import api server
|
||||
from llama_cpp.server import __main__ as server
|
||||
# Run
|
||||
uvicorn.run(server.app, host=args.host, port=args.port)
|
Reference in a new issue