From 398b9035f8149402f8736a75ae9b3036bf7a7787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20B=2E=20Papp?= Date: Tue, 28 Feb 2023 14:30:26 -0500 Subject: [PATCH] feat(api): Started sending recommendations through HTTP API --- api.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/api.py b/api.py index f8d03ee..1846f44 100644 --- a/api.py +++ b/api.py @@ -1,6 +1,5 @@ from fastapi import FastAPI - -from app import getUserProfile +import json from recommend import Recommender, Recs app = FastAPI() @@ -8,13 +7,9 @@ @app.get("/recommend/") async def read_item(userID: str): - # rec = Recommender(target=userID) - # await rec.recommend() - # account = await getUserProfile(userID) - rec = Recs() - res = rec.run() + res = await rec.run() - print(res.json()) + cleaned_data = json.loads(res) - return {"user": userID, "data": res} + return {"user": userID, "data": cleaned_data[0:50]}