shreyankisiri commited on
Commit
0f6b22c
·
verified ·
1 Parent(s): 9dc6b68

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -2
main.py CHANGED
@@ -57,8 +57,14 @@ async def health():
57
  return {"status": "OK"}
58
 
59
  @app.post("/search")
60
- async def search(request: SearchRequest):
61
- top_courses = find_similar_courses(request.query)
 
 
 
 
 
 
62
  return [course["course_id"] for course in top_courses]
63
 
64
  if __name__ == "__main__":
 
57
  return {"status": "OK"}
58
 
59
  @app.post("/search")
60
+ async def search(request: Request):
61
+ body = await request.json() # Get the JSON body of the request
62
+ query_text = body.get("query") # Extract the 'query' field from the body
63
+
64
+ if not query_text:
65
+ return {"error": "Query parameter is required."}
66
+
67
+ top_courses = find_similar_courses(query_text)
68
  return [course["course_id"] for course in top_courses]
69
 
70
  if __name__ == "__main__":