Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -83,26 +83,27 @@ def recommend(query):
|
|
83 |
# --- API Endpoints ---
|
84 |
@app.get("/health")
|
85 |
async def health_check():
|
86 |
-
return JSONResponse(
|
87 |
-
|
|
|
|
|
|
|
88 |
@app.post("/recommend")
|
89 |
async def recommend_api(request: Request):
|
90 |
body = await request.json()
|
91 |
query = body.get("query", "").strip()
|
92 |
if not query:
|
93 |
-
return JSONResponse(
|
|
|
|
|
|
|
|
|
94 |
result = recommend(query)
|
95 |
-
return JSONResponse(
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
inputs=gr.Textbox(label="Enter Job Description", lines=4),
|
101 |
-
outputs="json",
|
102 |
-
title="SHL Assessment Recommender",
|
103 |
-
description="Paste a job description to get the most relevant SHL assessments."
|
104 |
-
)
|
105 |
-
|
106 |
# Mount Gradio app at root
|
107 |
app = mount_gradio_app(app, gradio_iface, path="/")
|
108 |
|
|
|
83 |
# --- API Endpoints ---
|
84 |
@app.get("/health")
|
85 |
async def health_check():
|
86 |
+
return JSONResponse(
|
87 |
+
status_code=200,
|
88 |
+
content={"status": "healthy"},
|
89 |
+
media_type="application/json"
|
90 |
+
)
|
91 |
@app.post("/recommend")
|
92 |
async def recommend_api(request: Request):
|
93 |
body = await request.json()
|
94 |
query = body.get("query", "").strip()
|
95 |
if not query:
|
96 |
+
return JSONResponse(
|
97 |
+
status_code=400,
|
98 |
+
content={"error": "Missing 'query' in request body"},
|
99 |
+
media_type="application/json"
|
100 |
+
)
|
101 |
result = recommend(query)
|
102 |
+
return JSONResponse(
|
103 |
+
status_code=200,
|
104 |
+
content=result,
|
105 |
+
media_type="application/json"
|
106 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
# Mount Gradio app at root
|
108 |
app = mount_gradio_app(app, gradio_iface, path="/")
|
109 |
|