def METHOD_NAME(request: Request):
    nonlocal dsk_composition, templates, no_optimization
    with BytesIO() as f:
        visualize(dsk_composition, fhandle=f, no_optimization=no_optimization)
        f.seek(0)
        raw = f.read()
    encoded = base64.b64encode(raw).decode("ascii")
    return templates.TemplateResponse("dag.html", {"request": request, "encoded_image": encoded})