from fastapi import FastAPI import time import asyncio app = FastAPI() @app.get("/") async def root(): return {"message": "PGAI API"} @app.get("/info_sync") def info_sync(): print("sync") time.sleep(5) return {"message": "sync"} @app.get("/info_async") async def info_async(): print("async") await asyncio.sleep(5) return {"message": "async"}