From a34c88c18c2c83de27c992a74d228e66aff1912e Mon Sep 17 00:00:00 2001 From: julius Date: Wed, 12 Feb 2025 12:23:17 +0100 Subject: [PATCH] feat: async `render_sociogram` --- analysis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis.py b/analysis.py index fb9a20d..b682893 100644 --- a/analysis.py +++ b/analysis.py @@ -83,7 +83,7 @@ class Params(BaseModel): distance: float | None = 0.2 -def sociogram_image(params: Params): +async def render_sociogram(params: Params): plt.close() plt.figure(figsize=(16, 10), facecolor="none") ax = plt.gca() @@ -122,7 +122,7 @@ def sociogram_image(params: Params): analysis_router.add_api_route("/json", endpoint=sociogram_json, methods=["GET"]) -analysis_router.add_api_route("/image", endpoint=sociogram_image, methods=["POST"]) +analysis_router.add_api_route("/image", endpoint=render_sociogram, methods=["POST"]) if __name__ == "__main__": with Session(engine) as session: