-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
30 lines (21 loc) · 716 Bytes
/
app.py
File metadata and controls
30 lines (21 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from recommenders import klusterthon_oop as ko
app = FastAPI()
# Define a Pydantic model to structure the expected data
class ThreeObjects(BaseModel):
student_perf: list
course_tab: list
student_tab: list
@app.get("/")
async def check():
return "status ok"
@app.post("/recommender/")
async def recommend(data: ThreeObjects):
# Access the objects here
# For instance, you could print them:
result= ko.rec(data.student_perf, data.course_tab, data.student_tab)
# Return the objects as a response
return result
# Run the example using uvicorn from the command line:
# uvicorn main:app --reload