mirror of
https://git.isriupjv.fr/ISRI/ai-server
synced 2025-04-24 10:08:11 +02:00
25 lines
660 B
Python
25 lines
660 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)
|