feat: async render_sociogram

This commit is contained in:
julius 2025-02-12 12:23:17 +01:00
parent 0c830c1f8f
commit a34c88c18c
Signed by: julius
GPG Key ID: C80A63E6A5FD7092

View File

@ -83,7 +83,7 @@ class Params(BaseModel):
distance: float | None = 0.2 distance: float | None = 0.2
def sociogram_image(params: Params): async def render_sociogram(params: Params):
plt.close() plt.close()
plt.figure(figsize=(16, 10), facecolor="none") plt.figure(figsize=(16, 10), facecolor="none")
ax = plt.gca() 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("/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__": if __name__ == "__main__":
with Session(engine) as session: with Session(engine) as session: