hr_scoring / api.py
mahmodGendy's picture
Upload 12 files
ef416ef verified
raw
history blame contribute delete
746 Bytes
from fastapi import FastAPI, UploadFile
import shutil
import os
from services.resume_parser import parse_resume
from services.decision_engine import evaluate_resume
from database.logger import log_decision
app = FastAPI()
UPLOAD_DIR = "temp_uploads"
@app.post("/screen_resume")
async def screen_resume(file: UploadFile, job_title: str, level: str):
os.makedirs(UPLOAD_DIR, exist_ok=True)
path = f"{UPLOAD_DIR}/{file.filename}"
with open(path, "wb") as buffer:
shutil.copyfileobj(file.file, buffer)
resume_text = parse_resume(path)
result = evaluate_resume(resume_text, job_title, level)
log_decision(job_title, result["decision"])
os.remove(path)
return result