Skip to content

No0Bitah/cover-letter-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cover Letter Generator πŸ“

A smart, personalized cover letter generator that leverages the power of Ollama's local LLM models to create tailored cover letters based on your resume and job descriptions.

🌟 Features

  • Smart Resume Processing: Automatically extracts and cleans text from PDF, DOCX, and TXT files
  • Multiple Input Methods: Upload files or paste text directly
  • Local LLM Integration: Uses Ollama API for privacy-focused, local processing
  • Real-time Personalization: Interactive chat interface for further customization
  • Professional Formatting: Generates email-formatted cover letters with proper structure
  • Typing Animation: Smooth display of generated content
  • Session Management: Caches processed files to avoid reprocessing

πŸ› οΈ Technology Stack

  • Frontend: Streamlit
  • LLM: Ollama API with Gemma:2b model
  • PDF Processing: PyMuPDF (fitz), custom extraction module
  • Document Processing: python-docx
  • Backend: Python 3.7+

πŸ“‹ Prerequisites

  1. Ollama Installation: Install Ollama on your system

    # Visit https://ollama.ai to download and install
  2. Model Setup: Pull the Gemma:2b model

    ollama pull gemma:2b
  3. Python Dependencies: Install required packages

    pip install -r requirements.txt

πŸš€ Installation

  1. Clone the repository

    git clone <your-repository-url>
    cd cover-letter-generator
  2. Install dependencies

    pip install streamlit requests PyMuPDF python-docx
  3. Start Ollama service

    ollama serve
  4. Run the application

    streamlit run letter_creator.py

πŸ“ Project Structure

cover-letter-generator/
β”œβ”€β”€ letter_creator.py          # Main Streamlit application
β”œβ”€β”€ extract_resume.py          # PDF text extraction utilities
β”œβ”€β”€ resume_cleaner.py          # Resume text cleaning and processing
β”œβ”€β”€ requirements.txt           # Python dependencies
└── README.md                 # Project documentation

🎯 Usage

Step 1: Upload Your Resume

  • Upload your resume file (PDF, DOCX, or TXT)
  • Or paste your resume text directly in the text area

Step 2: Add Job Description

  • Upload the job description file (PDF, DOCX, or TXT)
  • Or paste the job description text directly

Step 3: Generate Cover Letter

  • Click "πŸš€ Generate Cover Letter"
  • Wait for the AI to process and generate your personalized cover letter

Step 4: Personalize Further (Optional)

  • Use the chat interface to request modifications
  • Examples: "Make it more formal", "Add emphasis on teamwork", "Make it shorter"

βš™οΈ Configuration

Ollama Settings

You can modify the Ollama configuration in letter_creator.py:

# Default Ollama API endpoint
Ollama_API_URL = "http://localhost:11434/api/generate"

# Model configuration
MODEL_NAME = "gemma:2b"  # Change to your preferred model

# Generation parameters
"temperature": 0.7,  # Creativity level (0.0-1.0)
"top_p": 0.9,       # Diversity control (0.0-1.0)

Supported File Types

  • PDF: Processed using PyMuPDF with fallback extraction
  • DOCX: Microsoft Word documents
  • TXT: Plain text files

πŸ”§ Key Functions

generate_cover_letter_prompt(resume_text, job_description)

Creates a comprehensive prompt for the LLM with specific instructions for:

  • Professional tone and format
  • Technology matching between resume and job description
  • Enthusiasm for learning new technologies
  • Concise, email-format output

read_file(file, file_type)

Handles multiple file formats with intelligent processing:

  • PDF extraction with cleanup
  • DOCX paragraph extraction
  • TXT direct reading
  • Resume cleaning for type 0 (resume files)

query_ollama(prompt)

Communicates with the Ollama API:

  • Sends structured requests
  • Handles response parsing
  • Error handling and reporting

display_text(response, typing_speed)

Creates an engaging user experience:

  • Typing animation effect
  • Professional styling
  • Session state management

🎨 UI Features

  • Sidebar Navigation: Clean file upload and text input areas
  • Real-time Feedback: Success/error messages and loading spinners
  • Responsive Design: Professional styling with centered layout
  • Interactive Chat: Post-generation customization interface

πŸ›‘οΈ Privacy & Security

  • Local Processing: All data processing happens locally using Ollama
  • No Data Storage: Files are processed in memory, not saved permanently
  • Session-based: Data exists only during your session

πŸ” Troubleshooting

Common Issues

  1. Ollama Connection Error

    • Ensure Ollama is running: ollama serve
    • Check if the model is installed: ollama list
  2. File Processing Issues

    • Ensure files are not corrupted
    • Check file size limitations
    • Verify file format compatibility
  3. Performance Issues

    • Consider using a more powerful model
    • Adjust temperature and top_p parameters
    • Ensure sufficient system resources

πŸ“Š Performance Tips

  • Model Selection: Gemma:2b is efficient; consider larger models for better quality
  • File Size: Smaller files process faster
  • Prompt Engineering: The built-in prompt is optimized for best results

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit changes: git commit -m 'Add feature'
  4. Push to branch: git push origin feature-name
  5. Submit a pull request

πŸ“„ License

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

πŸ™ Acknowledgments

  • Ollama for providing local LLM capabilities
  • Streamlit for the amazing web framework
  • PyMuPDF for PDF processing

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the troubleshooting section
  2. Review Ollama documentation
  3. Open an issue in the repository

Made with by No0Bitah πŸ‘‹

About

A Streamlit-powered cover letter generator that uses Ollama AI to create personalized cover letters from resume and job description files. Features real-time customization, multiple file format support (PDF, DOCX, TXT), and an interactive chat interface for further personalization.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages