Spaces:
Runtime error
Runtime error
File size: 529 Bytes
b92e027 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | """Convenience runner for launching the FastAPI service with Windows-safe loop."""
from __future__ import annotations
import asyncio
import os
import uvicorn
from uvicorn import Config, Server
if __name__ == "__main__":
config = Config("api_server:app", host="0.0.0.0", port=8000, reload=False)
server = Server(config)
if os.name == "nt":
loop = asyncio.SelectorEventLoop()
asyncio.set_event_loop(loop)
loop.run_until_complete(server.serve())
else:
asyncio.run(server.serve())
|