4b81334
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from fastapi import FastAPI from fastapi.responses import StreamingResponse import time app = FastAPI() def stream(): for i in range(3): time.sleep(1) yield f"chunk {i}\n" @app.get("/") def get_stream(): return StreamingResponse(stream())