Spaces:
Running
Running
Johnny
updated resume_format > template, hide sidebar, download Spacy model with spacy_loader.py
102e49d
# TalentLens | |
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.parser import parse_resume, extract_email, summarize_resume | |
from utils.hybrid_extractor import extract_resume_sections | |
from utils.builder import build_resume_from_data | |
from utils.screening import evaluate_resumes | |
from utils.reporting import generate_pdf_report, generate_interview_questions_from_summaries | |
# ------------------------- Main App Function ------------------------- | |
def main(): | |
st.set_page_config( | |
page_title="TalentLens.AI", | |
layout="centered", | |
initial_sidebar_state="collapsed" | |
) | |
# Hide sidebar completely with CSS | |
st.markdown(""" | |
<style> | |
.css-1d391kg {display: none} | |
.css-1rs6os {display: none} | |
.css-17ziqus {display: none} | |
[data-testid="stSidebar"] {display: none} | |
[data-testid="collapsedControl"] {display: none} | |
.css-1lcbmhc {display: none} | |
.css-1outpf7 {display: none} | |
.sidebar .sidebar-content {display: none} | |
</style> | |
""", unsafe_allow_html=True) | |
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") | |
# Main action buttons | |
col1, col2 = st.columns(2) | |
with col1: | |
# Evaluation trigger | |
evaluate_clicked = st.button("π Evaluate Resumes", type="primary", use_container_width=True) | |
with col2: | |
# Format Resume redirect button | |
format_clicked = st.button("π Format Resume", use_container_width=True) | |
# Handle Format Resume redirect | |
if format_clicked: | |
st.switch_page("pages/Template.py") | |
# Handle Evaluate Resumes | |
if evaluate_clicked: | |
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() |