Skip to main content

AI-powered CV analysis and job matching library with web UI

Project description

CV Matcher ๐ŸŽฏ

An AI-powered Python library for analyzing CVs (resumes) against job descriptions. Get match scores, identify missing skills, and receive expert formatting advice to improve your CV.

โœจ Features Web UI with OpenAI GPT-4 for Best Performance โœจ

Python Version License: MIT

Features โœจ

  • ๐ŸŒ Web UI: Beautiful Gradio-based interface - no coding required!
  • ๐Ÿค– AI-Powered Analysis: OpenAI GPT-4 for intelligent, accurate analysis
  • ๐Ÿ”“ Local Models Option: Use local AI models (Phi-3, Mistral, etc.) - no API keys required
  • ๐Ÿ“„ PDF CV Parsing: Extract text from PDF CVs with ease
  • ๐Ÿ” Job Description Fetching: Accept job descriptions as text or fetch from URLs
  • ๐Ÿ“Š Detailed Match Scoring: Get scores for skills, experience, education, and keywords
  • ๐Ÿ’ก Formatting Advice: Receive actionable suggestions to improve your CV
  • ๐ŸŽจ Beautiful Output: Rich, colorful terminal and web UI
  • ๐Ÿ“ค Export Results: Save analysis results to JSON for further processing

Installation ๐Ÿ“ฆ

Using pip

pip install cv-matcher

# Create a .env file for configuration
cp .env.example .env

# Edit .env and set your preferences:
# - USE_LOCAL_MODEL=false (use OpenAI, recommended)
# - USE_LOCAL_MODEL=true (use local models, no API key needed)
# - OPENAI_API_KEY=your-key-here (required if USE_LOCAL_MODEL=false)

For Local Models Only

# Install with local model dependencies
pip install cv-matcher[local]

# Set USE_LOCAL_MODEL=true in .env
echo "USE_LOCAL_MODEL=true" > .env

Using uv (recommended for development)

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone https://github.com/yourusername/cv-matcher.git
cd cv-matcher

# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e .

Configuration โš™๏ธ

Environment Variables (.env file)

Create a .env file in your project root to configure the AI backend:

# Toggle between local and OpenAI models
USE_LOCAL_MODEL=false  # false=OpenAI (default), true=local models

# OpenAI Configuration (required if USE_LOCAL_MODEL=false)
OPENAI_API_KEY=your-openai-api-key-here
# OPENAI_MODEL=gpt-4o-mini  # Optional, defaults to gpt-4o-mini

# Local Model Configuration (used if USE_LOCAL_MODEL=true)
# LOCAL_MODEL_NAME=microsoft/Phi-3-mini-4k-instruct  # Optional

Switching Models:

  • Set USE_LOCAL_MODEL=false to use OpenAI (faster, more accurate, requires API key)
  • Set USE_LOCAL_MODEL=true to use local models (private, no API key, slower)

The launcher script automatically reads these settings - no code changes needed!

Quick Start ๐Ÿš€

Option 1: Web UI (Easiest! ๐ŸŒ)

from cv_matcher import launch_ui

# Launch the web interface
# Uses settings from .env file (USE_LOCAL_MODEL and OPENAI_API_KEY)
launch_ui()

Or launch from command line:

python launch_ui.py  # Reads USE_LOCAL_MODEL from .env

Then open your browser to http://localhost:7860 and start analyzing CVs!

๐Ÿ’ก Tip: Toggle between OpenAI and local models by changing USE_LOCAL_MODEL in your .env file - no code changes needed!

Option 2: Python API with OpenAI (Recommended! โšก)

import os
from cv_matcher import CVMatcher

# Set your OpenAI API key
os.environ["OPENAI_API_KEY"] = "your-api-key-here"

# Initialize with OpenAI (default for best performance)
matcher = CVMatcher(use_local_model=False)

# Analyze a CV against a job description
analysis = matcher.analyze_cv(
    cv_path="path/to/cv.pdf",
    job_description="Job description text or URL here",
    verbose=True
)

# Print the results
matcher.print_analysis(analysis)

# Export to JSON
matcher.export_analysis(analysis, "analysis_results.json")

Option 3: Use Local Models (No API Key Required ๐Ÿ”“)

from cv_matcher import CVMatcher

# Use local AI model (no API key needed, but slower)
matcher = CVMatcher(
    use_local_model=True,
    local_model_name="microsoft/Phi-3-mini-4k-instruct"  # Optional, this is default
)
    api_key="your-openai-api-key"
)

analysis = matcher.analyze_cv("cv.pdf", "job description")

Launch Web UI from Command Line

# Simple way
python launch_ui.py

# Or with Python
python -c "from cv_matcher import launch_ui; launch_ui()"

# Create a public URL to share
python -c "from cv_matcher import launch_ui; launch_ui(share=True)"

Job Description from URL

matcher = CVMatcher()

# Fetch job description from a URL
analysis = matcher.analyze_cv(
    cv_path="cv.pdf",
    job_description="https://example.com/job-posting"
)

API Configuration ๐Ÿ”ง

CVMatcher Parameters

CVMatcher(
    use_local_model: bool = False,    # False=OpenAI (default), True=local models
    local_model_name: str = "microsoft/Phi-3-mini-4k-instruct",
    api_key: Optional[str] = None,    # OpenAI key (reads from .env if not provided)
    model: str = "gpt-4o-mini",       # OpenAI model name
    timeout: int = 10                 # HTTP timeout in seconds
)

Recommended: Use .env file for configuration instead of hardcoding parameters.

Supported Local Models (No API Key Required)

  • microsoft/Phi-3-mini-4k-instruct (default, fast, 3.8B parameters)
  • mistralai/Mistral-7B-Instruct-v0.2 (larger, more capable)
  • Any Hugging Face instruction-tuned chat model

Supported OpenAI Models (Requires API Key)

  • gpt-4o-mini (cost-effective)
  • gpt-4o (more advanced)
  • gpt-4-turbo (high performance)

Output Format ๐Ÿ“‹

The analysis returns a CVAnalysis object containing:

Match Score

  • Overall Score: 0-100% match rating
  • Skills Match: How well skills align
  • Experience Match: Experience level alignment
  • Education Match: Education requirements match
  • Keywords Match: Important keywords coverage
  • Matching/Missing Skills: Lists of skills found and needed
  • Matching/Missing Keywords: Key terms analysis

Formatting Advice

  • Strengths: What your CV does well
  • Weaknesses: Areas needing improvement
  • Suggestions: Specific, actionable recommendations
  • Structure Feedback: Layout and organization advice
  • Content Feedback: Content quality assessment

Summary & Recommendation

  • Overall assessment of the CV-job fit
  • Clear recommendation for next steps

Examples ๐Ÿ“š

Check out the examples directory for more detailed usage examples:

  • local_model_usage.py: Using local AI models (no API key)
  • basic_usage.py: Simple CV analysis (works with both local and OpenAI)
  • batch_analysis.py: Analyze multiple CVs
  • url_fetching.py: Fetch job descriptions from URLs
  • custom_model.py: Use different AI models
  • launch_ui.py: Launch the web interface

Development ๐Ÿ› ๏ธ

Setup Development Environment

# Clone the repository
git clone https://github.com/officialgabzz/cv-matcher.git
cd cv-matcher

# Install with development dependencies
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"

Running Tests

pytest tests/ -v --cov=cv_matcher

Code Formatting

# Format code
black src/cv_matcher

# Lint code
ruff check src/cv_matcher

# Type checking
mypy src/cv_matcher

Project Structure ๐Ÿ“

cv-matcher/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ cv_matcher/
โ”‚       โ”œโ”€โ”€ __init__.py          # Package initialization
โ”‚       โ”œโ”€โ”€ matcher.py           # Main CVMatcher class
โ”‚       โ”œโ”€โ”€ models.py            # Pydantic data models
โ”‚       โ”œโ”€โ”€ pdf_parser.py        # PDF text extraction
โ”‚       โ”œโ”€โ”€ job_fetcher.py       # Job description fetching
โ”‚       โ””โ”€โ”€ ai_analyzer.py       # AI analysis logic
โ”œโ”€โ”€ tests/                       # Test files
โ”œโ”€โ”€ examples/                    # Usage examples
โ”œโ”€โ”€ pyproject.toml              # Project configuration
โ”œโ”€โ”€ README.md                   # This file
โ””โ”€โ”€ LICENSE                     # MIT License

Requirements ๐Ÿ“‹

  • Python 3.9+
  • No API keys required (when using local models)
  • Dependencies (automatically installed):
    • pypdf
    • requests
    • beautifulsoup4
    • transformers
    • torch
    • gradio
    • pydantic
    • rich
    • accelerate

Note: First run will download the AI model (~3-7GB depending on model choice). Subsequent runs use cached model.

API Reference ๐Ÿ“–

CVMatcher

Main class for CV analysis.

Methods

  • analyze_cv(cv_path, job_description, verbose=False): Analyze a CV
  • print_analysis(analysis, detailed=True): Display results
  • export_analysis(analysis, output_path): Save to JSON

Models

  • CVAnalysis: Complete analysis result
  • MatchScore: Match scoring details
  • FormattingAdvice: CV improvement suggestions

Privacy & Security ๐Ÿ”’

With Local Models (Default) ๐Ÿ”

  • 100% Private: All data stays on your machine
  • No internet required: Model runs completely offline after initial download
  • No API keys: No external services involved
  • Your data never leaves your computer

With OpenAI (Optional)

  • Your CV and job description data are sent to OpenAI for analysis
  • No data is stored by this library
  • Use environment variables for API keys (never hardcode them)
  • Consider using .env files (excluded from git) for local development

Contributing ๐Ÿค

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License ๐Ÿ“„

This project is licensed under the MIT License - see the LICENSE file for details.

Roadmap ๐Ÿ—บ๏ธ

  • Web UI with Gradio
  • Local AI models (no API key required)
  • Support for more file formats (DOCX, TXT)
  • Mobile-responsive UI
  • Custom AI prompts for specific industries
  • Integration with job board APIs
  • Resume builder based on job description
  • Batch processing UI
  • Multi-language support
  • Docker container for easy deployment

Support ๐Ÿ’ฌ

Acknowledgments ๐Ÿ™

  • OpenAI for providing the GPT API
  • The Python community for excellent libraries
  • All contributors and users of this library

Made with โค๏ธ by the CV Matcher team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cv_matcher-0.4.0.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cv_matcher-0.4.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file cv_matcher-0.4.0.tar.gz.

File metadata

  • Download URL: cv_matcher-0.4.0.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for cv_matcher-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d9a2a5d392304cc089088d12230fb9d4de2be1e1751711fd63b4bf8d962f7b6a
MD5 f5842c8c80c832e706f7d126e3c207c2
BLAKE2b-256 da13cf3b4c677f0e598a7caf1ffe251370a1a0121621ce87041cd1aa52a5f471

See more details on using hashes here.

File details

Details for the file cv_matcher-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: cv_matcher-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for cv_matcher-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4047a263b02432a61c08779fd16f267ce4e73436f98b69c51703b00e271b3e88
MD5 1a1b176e64e6c8894fe7dec1aceaa01b
BLAKE2b-256 9ef539d5c84bd4c988cb45eb745edf8615b956b89490971ca48def74e3ac3365

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page