Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 2 of 2 for stream_image_no_async_no_annotation (0.54 seconds)

  1. docs_src/stream_data/tutorial002_py310.py

        with read_image() as image_file:
            for chunk in image_file:
                yield chunk
    
    
    @app.get("/image/stream-no-async-no-annotation", response_class=PNGStreamingResponse)
    def stream_image_no_async_no_annotation():
        with read_image() as image_file:
            for chunk in image_file:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 20:51:40 GMT 2026
    - 5.6K bytes
    - Click Count (0)
  2. fastapi/.agents/skills/fastapi/references/streaming.md

    from app.utils import read_image
    
    app = FastAPI()
    
    
    class PNGStreamingResponse(StreamingResponse):
        media_type = "image/png"
    
    @app.get("/image", response_class=PNGStreamingResponse)
    def stream_image_no_async_no_annotation():
        with read_image() as image_file:
            yield from image_file
    ```
    
    prefer this over returning a `StreamingResponse` directly:
    
    ```python
    # DO NOT DO THIS
    
    import anyio
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 10:05:57 GMT 2026
    - 2.5K bytes
    - Click Count (0)
Back to Top