--- title: TalentLensAI emoji: 🏃 colorFrom: red colorTo: green sdk: streamlit sdk_version: 1.43.1 app_file: app.py pinned: false license: apache-2.0 short_description: 'AI - Powered Resume Screening Bot Application ' --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference TalentLensAI is an AI-powered resume screening and evaluation tool that leverages Hugging Face models for summarization and scoring. It integrates with Supabase for candidate data storage and utilizes Streamlit for an interactive user interface. ## Features Resume Summarization: Uses Facebook's BART model (facebook/bart-large-cnn) to generate a concise summary of the resume. Candidate Scoring: Evaluates resumes using Google's Gemma model (google/gemma-7b) to determine their relevance to the job description. Database Integration: Stores candidate information, resume summary, and scores in Supabase. PDF Report Generation: Generates a PDF report summarizing the evaluation results. Streamlit UI: Provides a user-friendly interface for uploading resumes and reviewing results. ## Deployment Notes ### SpaCy Model Handling The application uses spaCy for natural language processing. To handle deployment environments where the `en_core_web_sm` model might not be available: - The spaCy model is automatically downloaded via requirements.txt - A fallback system (`utils/spacy_loader.py`) provides graceful degradation - If spaCy is unavailable, the system uses regex-based extraction methods ### Hugging Face Spaces Deployment For Hugging Face Spaces deployment, the following files are configured: - `requirements.txt`: Includes direct spaCy model download link - `packages.txt`: System dependencies for spaCy compilation - `utils/spacy_loader.py`: Robust model loading with fallbacks - NumPy version pinned to `<2.0` for compatibility ## Setup Instructions 1. Clone the Repository ``` git clone https://github.com/yourusername/TalentLensAI.git cd TalentLensAI ``` 2. Create a Virtual Environment and Install Dependencies ``` python -m venv myenv source myenv/bin/activate # On Windows use `myenv\Scripts\activate` pip install -r requirements.txt ``` 3. Configure Environment Variables Create a .env file in the root directory and add the following: ``` HUGGINGFACE_API_KEY=your_huggingface_api_key SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_anon_key ``` 4. Run the Application ``` streamlit run main.py ``` Updated Functionality Querying Hugging Face Models The application now supports querying both gemma-7b and bart-large-cnn models: def query(payload, model="gemma"): if model not in HF_MODELS: raise ValueError("Invalid model name. Choose 'gemma' or 'bart'.") api_url = f"https://api-inference.huggingface.co/models/{HF_MODELS[model]}" try: response = requests.post(api_url, headers=HF_HEADERS, json=payload) if response.status_code == 401: print(f"❌ Unauthorized: Check your Hugging Face API key for model '{model}'.") return None response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: print(f"❌ Error querying Hugging Face model '{model}': {e}") return None Fixed Issues & Improvements Fixed UnboundLocalError by ensuring response is always initialized before use. Handled 401 Unauthorized errors by validating the Hugging Face API key at startup. Enhanced Supabase Integration to prevent null values from violating constraints. Modularized st.markdown styling for a better Streamlit UI experience. Database Schema The candidates table in Supabase is structured as follows: CREATE TABLE candidates ( id SERIAL PRIMARY KEY, resume_filename TEXT NOT NULL, email TEXT NOT NULL, name TEXT NOT NULL, resume_text TEXT NOT NULL, score FLOAT NOT NULL, created_at TIMESTAMP DEFAULT NOW(), summary TEXT NOT NULL ); Testing Unit tests are implemented using pytest. Run tests with: pytest tests/ Roadmap ✅ Multi-model support for Hugging Face APIs ✅ Improved error handling for API failures 🔜 Enhance the resume parsing for better job-specific keyword extraction 🔜 Implement email notifications for shortlisted candidates Contributors Gaurav Sharma Jonathan Nguyen License This project is licensed under the MIT License - see the LICENSE file for details.