TalentLensAI / app.py
Johnny
added requirements.txt updated gitignore
e11a248
raw
history blame
1.28 kB
import streamlit as st
from database import get_db, Candidate
from resume_parser import extract_text_from_pdf
from ai_model import analyze_resume
from pdf_generator import generate_summary_pdf
from sqlalchemy.orm import Session
st.title("AI-Powered Resume Screening")
uploaded_files = st.file_uploader("Upload Resumes", type=["pdf"], accept_multiple_files=True)
if uploaded_files:
db: Session = next(get_db())
candidates = []
for file in uploaded_files:
resume_text = extract_text_from_pdf(file)
analysis_result = analyze_resume(resume_text)
score = int(analysis_result.get("score", 0))
summary = analysis_result.get("summary", "No summary available")
new_candidate = Candidate(name=file.name, score=score, summary=summary, resume_text=resume_text)
db.add(new_candidate)
candidates.append(new_candidate)
db.commit()
# Generate shortlist
shortlisted = sorted(candidates, key=lambda x: x.score, reverse=True)[:5]
pdf_path = generate_summary_pdf(shortlisted)
st.success("Top candidates shortlisted!")
st.download_button("Download Shortlist PDF", open(pdf_path, "rb"), file_name="shortlisted_candidates.pdf")
# the link expiration time is set to 24 hours