zephyr-backend/cosmic/__init__.py
2025-01-24 17:21:49 +08:00

22 lines
512 B
Python

from io import BytesIO
from quart import Blueprint, request, send_file
from matplotlib import pyplot as plt
from cosmic.temp_render import temp_render
cosmic_module = Blueprint("Cosmic", __name__)
@cosmic_module.route('/metadata')
def get_meta():
return []
@cosmic_module.route('/temp_render')
async def render():
T = request.args.get("T", 16)
temp_render(T=int(T))
buf = BytesIO()
plt.savefig(buf, format="png")
buf.seek(0)
return await send_file(buf, mimetype="image/png")