Former-commit-id: b0888262e3
This commit is contained in:
hiyouga
2024-05-07 17:50:27 +08:00
parent 07ac5fe1b0
commit 52cc6bce38
7 changed files with 43 additions and 5 deletions

19
src/api.py Normal file
View File

@@ -0,0 +1,19 @@
import os
import uvicorn
from llmtuner.api.app import create_app
from llmtuner.chat import ChatModel
def main():
chat_model = ChatModel()
app = create_app(chat_model)
api_host = os.environ.get("API_HOST", "0.0.0.0")
api_port = int(os.environ.get("API_PORT", "8000"))
print("Visit http://localhost:{}/docs for API document.".format(api_port))
uvicorn.run(app, host=api_host, port=api_port)
if __name__ == "__main__":
main()