CoolFace
Modelpublic

Frankenstein-Labs/Cortex-ai

sourceHugging Facemitupdated 7d agoView on Hugging Face
1likes1.3kdownloads
serve.py37 linesDownload Raw Back to api
1"""Run the CORTEX AI API server.2 3    python -m cortex_ai.api.serve4 5Uses the mock adapter by default so the server starts on any machine. Set6CORTEX_ADAPTER=hf to load the real checkpoint instead.7"""8 9from __future__ import annotations10 11import os12 13from .server import create_app14from ..adapters.mock import MockAdapter15from ..config import CortexConfig16 17 18def build_adapter(config: CortexConfig):19    kind = os.getenv("CORTEX_ADAPTER", "mock").lower()20    if kind == "hf":21        from ..adapters.hf_adapter import HFAdapter22 23        return HFAdapter(config.model_id).load()24    return MockAdapter()25 26 27def main() -> None:28    import uvicorn29 30    config = CortexConfig.from_env()31    app = create_app(build_adapter(config), config)32    uvicorn.run(app, host=config.server.host, port=config.server.port)33 34 35if __name__ == "__main__":36    main()37