ai-server/source/__main__.py

26 lines
661 B
Python

import os
from source import registry, model, api
from source.api import interface
# create a fastapi application
application = api.Application()
# create the interface registry
interface_registry = registry.InterfaceRegistry()
interface_registry.register_type("chat", interface.ChatInterface)
# create the model registry
model_registry = registry.ModelRegistry(os.environ["MODEL_LIBRARY"], "/models", interface_registry)
model_registry.register_type("python", model.PythonModel)
model_registry.reload_models()
# add the model registry routes to the fastapi
model_registry.mount(application)
# serve the application
application.serve("0.0.0.0", 8000)