forked from h2oai/h2o-llmstudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
38 lines (23 loc) · 818 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import logging
import os
from llm_studio.src.utils.logging_utils import initialize_logging
os.environ["MKL_THREADING_LAYER"] = "GNU"
from h2o_wave import Q, app, copy_expando, main, ui # noqa: F401
from app_utils.handlers import handle
from app_utils.initializers import initialize_app, initialize_client
from app_utils.sections.common import interface
logger = logging.getLogger(__name__)
def on_startup():
initialize_logging()
logger.info("STARTING APP")
@app("/", on_startup=on_startup)
async def serve(q: Q):
"""Serving function."""
if not q.app.initialized:
await initialize_app(q)
copy_expando(q.args, q.client)
await initialize_client(q)
await handle(q)
if not q.args["experiment/display/chat/chatbot"]:
await interface(q)
await q.page.save()