Spaces:
Runtime error
Runtime error
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from typing import List | |
| app = FastAPI() | |
| from ranker import rank_resume | |
| # Function to wrap the existing rank_resume | |
| def process_input(job_description, resumes): | |
| print("[JOB DESC]", job_description) | |
| print("[RESUMES]", resumes) | |
| resumes = [r for r in resumes if r and r.strip() != ""] # Remove empty | |
| if not job_description.strip() or not resumes: | |
| return "Please provide both job description and at least one resume." | |
| return rank_resume(job_description, resumes)[1] | |
| app.get("/") | |
| def read_root(): | |
| return {"message": "Hello, World!"} | |
| class InputData(BaseModel): | |
| resumes: List[str] | |
| job_description: str | |
| async def process_data(data: InputData): | |
| return dict(scores=process_input(data.job_description, data.resumes)) | |