Spaces:
Running
Running
File size: 2,796 Bytes
2854e2c 56325dc 19ea0c5 2854e2c 56325dc 2854e2c 56325dc edfcf73 8f8f414 edfcf73 8f8f414 2854e2c 0c91845 8f8f414 2854e2c 8f8f414 2854e2c 8f8f414 2854e2c 8f8f414 2854e2c 8f8f414 2854e2c 8f8f414 949011b 2854e2c 8f8f414 2854e2c 8f8f414 56325dc 2854e2c 56325dc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
import os
from io import BytesIO
import streamlit as st
import fitz # PyMuPDF
import requests
from dotenv import load_dotenv
from config import supabase, HF_API_TOKEN, HF_HEADERS, HF_MODELS
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,
)
# ------------------------- Main App Function -------------------------
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)
# Upload resumes (limit: 10 files)
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
# Input job description
job_description = st.text_area("Enter Job Description")
# Evaluation trigger
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
st.write("### 📊 Evaluating Resumes...")
# Resume Evaluation
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 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}")
# Downloadable PDF Report
pdf_report = generate_pdf_report(shortlisted, questions)
st.download_button("Download Shortlist Report", pdf_report, "shortlist.pdf")
# Removed Candidates Info
if removed_candidates:
st.subheader("❌ Resumes Removed:")
for removed in removed_candidates:
st.write(f"**{removed['name']}** - {removed['reason']}")
# ------------------------- Run the App -------------------------
if __name__ == "__main__":
main() |