Spaces:
Running
Running
import streamlit as st | |
from utils import ( | |
evaluate_resumes, generate_pdf_report, store_in_supabase, extract_email, | |
score_candidate, parse_resume, summarize_resume, extract_keywords, generate_interview_questions_from_summaries | |
) | |
from config import supabase | |
from config import HF_API_TOKEN, HF_HEADERS, HF_MODELS | |
import fitz # PyMuPDF | |
from io import BytesIO | |
from dotenv import load_dotenv | |
import os | |
import requests | |
def main(): | |
st.set_page_config(page_title="TalentLens.AI", layout="centered") | |
st.markdown("<h1 style='text-align: center;'>TalentLens.AI</h1>", unsafe_allow_html=True) | |
st.divider() | |
st.markdown("<h3 style='text-align: center;'>AI-Powered Intelligent Resume Screening</h3>", unsafe_allow_html=True) | |
# Limit resume uploads to 10 | |
uploaded_files = st.file_uploader("Upload Resumes (PDF Only, Max: 10)", accept_multiple_files=True, type=["pdf"]) | |
if uploaded_files and len(uploaded_files) > 10: | |
st.error("β οΈ You can upload a maximum of 10 resumes at a time.") | |
return | |
job_description = st.text_area("Enter Job Description") | |
if st.button("Evaluate Resumes"): | |
if not job_description: | |
st.error("β οΈ Please enter a job description.") | |
return | |
if not uploaded_files: | |
st.error("β οΈ Please upload at least one resume.") | |
return | |
#if uploaded_files and job_description: | |
st.write("### π Evaluating Resumes...") | |
# πΉ Extract required keywords dynamically from the job description | |
# required_keywords = extract_keywords(job_description) | |
# st.write(f"**Extracted Keywords:** {', '.join(required_keywords)}") | |
shortlisted, removed_candidates = evaluate_resumes(uploaded_files, job_description) | |
if not shortlisted: | |
st.warning("β οΈ No resumes matched the required keywords.") | |
else: | |
st.subheader("β Shortlisted Candidates:") | |
for candidate in shortlisted: | |
st.write(f"**{candidate['name']}**") | |
# Generate PDF Report | |
pdf_report = generate_pdf_report(shortlisted) | |
st.download_button("Download Shortlist Report", pdf_report, "shortlist.pdf") | |
# Generate Interview Questions | |
questions = generate_interview_questions_from_summaries(shortlisted) | |
st.subheader("π§ Suggested Interview Questions:") | |
for idx, q in enumerate(questions, 1): | |
st.markdown(f"**Q{idx}.** {q}") | |
# π» Display removed candidates due to missing keywords | |
if removed_candidates: | |
st.subheader("β Resumes Removed:") | |
for removed in removed_candidates: | |
st.write(f"**{removed['name']}** - {removed['reason']}") | |
if __name__ == "__main__": | |
main() |