#!/usr/bin/env python3 import gradio as gr import os import re # Basic configuration OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY") SERPAPI_KEY = os.getenv("SERPAPI_KEY") FIRECRAWL_API_KEY = os.getenv("FIRECRAWL_API_KEY") def is_url(text: str) -> bool: """Check if text contains a URL""" url_pattern = r'https?://[^\s<>"{}|\\^`\[\]]+' return bool(re.search(url_pattern, text)) def enhanced_analysis(resume_text: str, job_text: str) -> str: """Enhanced analysis with comprehensive features""" if not resume_text.strip(): return "❌ Please provide your resume text or extract it from PDF using the tools below." if not job_text.strip(): return "❌ Please provide a job description or URL." # Enhanced analysis resume_words = resume_text.lower().split() job_words = job_text.lower().split() # Detect if it's a URL is_job_url = is_url(job_text) url_message = "" if is_job_url: url_message = f"""
🔗 URL Detected: Job posting will be automatically processed for enhanced analysis
""" # Expanded skill detection (75+ skills) tech_skills = [ "python", "javascript", "java", "c++", "c#", "sql", "html", "css", "react", "vue", "angular", "node", "express", "django", "flask", "spring", "laravel", "php", "ruby", "go", "rust", "kotlin", "swift", "typescript", "mongodb", "postgresql", "mysql", "redis", "elasticsearch", "aws", "azure", "gcp", "docker", "kubernetes", "jenkins", "git", "github", "gitlab", "linux", "windows", "macos", "terraform", "ansible", "microservices", "api", "rest", "graphql", "websocket", "oauth", "jwt", "machine learning", "ai", "data science", "pandas", "numpy", "tensorflow", "pytorch", "scikit-learn", "spark", "hadoop", "tableau", "power bi", "excel", "r", "matlab", "scala", "shell", "bash", "powershell", "devops", "ci/cd", "agile", "scrum", "kanban", "jira", "confluence", "slack", "figma", "sketch" ] soft_skills = [ "leadership", "teamwork", "communication", "problem solving", "project management", "collaboration", "mentoring", "training", "presentation", "documentation", "testing", "debugging", "optimization", "scalability", "performance", "security", "architecture", "design", "planning", "strategy", "analytical", "creative", "innovative", "adaptable", "reliable", "detail-oriented", "organized" ] # Find matching skills resume_tech_skills = [skill for skill in tech_skills if skill in resume_text.lower()] job_tech_skills = [skill for skill in tech_skills if skill in job_text.lower()] matching_tech = list(set(resume_tech_skills) & set(job_tech_skills)) resume_soft_skills = [skill for skill in soft_skills if skill in resume_text.lower()] job_soft_skills = [skill for skill in soft_skills if skill in job_text.lower()] matching_soft = list(set(resume_soft_skills) & set(job_soft_skills)) # Enhanced scoring algorithm tech_score = len(matching_tech) * 8 soft_score = len(matching_soft) * 5 length_bonus = min(len(resume_words) // 30, 20) keyword_bonus = 10 if any(word in resume_text.lower() for word in ["experience", "years", "project", "team"]) else 0 base_score = tech_score + soft_score + length_bonus + keyword_bonus final_score = min(max(base_score + 35, 45), 95) # Determine match level and color if final_score >= 85: match_level = "🟢 Excellent Match" match_color = "#27ae60" advice = "You're a strong candidate! Focus on specific examples and prepare confident answers." elif final_score >= 70: match_level = "🟡 Strong Match" match_color = "#f39c12" advice = "Good alignment! Highlight your relevant experience and show enthusiasm for learning." else: match_level = "🔴 Developing Match" match_color = "#e74c3c" advice = "Focus on transferable skills and demonstrate your ability to learn quickly." # Generate comprehensive results results_html = f""" {url_message}

🎯 IQKiller Analysis Report

{final_score}%
{match_level}
Job Compatibility Score

💡 Strategic Advice

{advice}

💪 Your Technical Strengths ({len(matching_tech)} matches)

    {"".join([f"
  • {skill.title()}
  • " for skill in matching_tech[:5]]) if matching_tech else "
  • General technical background
  • "}
  • Experience with {len(resume_tech_skills)} technologies
  • Professional development experience
  • Problem-solving capabilities

🎯 Key Soft Skills ({len(matching_soft)} matches)

    {"".join([f"
  • {skill.title()}
  • " for skill in matching_soft[:4]]) if matching_soft else "
  • Professional communication
  • "}
  • Team collaboration
  • Project execution
  • Continuous learning mindset

📋 Essential Interview Questions to Master

Technical Question:
"Walk me through your experience with {matching_tech[0] if matching_tech else 'your main technology stack'}. Can you describe a specific project where you used it effectively?"
Behavioral Question:
"Tell me about a time you faced a significant challenge in a project. How did you approach solving it, and what was the outcome?"
Project-Based Question:
"Describe a project you're particularly proud of. What was your role, what technologies did you use, and what impact did it have?"
Company-Specific Question:
"What excites you about this role and our company? How do you see yourself contributing to our team's success?"

🚀 Interview Preparation Strategy

Before the Interview:

  • Research company culture, recent news, and values
  • Prepare 3-4 STAR method examples for behavioral questions
  • Review technical concepts mentioned in the job posting
  • Prepare thoughtful questions about the role and team
  • Practice explaining your projects clearly and concisely

During the Interview:

  • Use specific examples from your experience
  • Show enthusiasm for learning and growth
  • Ask clarifying questions when needed
  • Demonstrate your problem-solving thought process
  • Connect your experience to their needs

💰 Salary Negotiation Tips

Based on your {final_score}% match score, you're in a {"strong" if final_score >= 80 else "good" if final_score >= 60 else "developing"} position to negotiate.

Research:
Know market rates for your experience level
Value:
Prepare to articulate your unique contributions
Package:
Consider total compensation, not just salary

✨ Analysis Summary

{len(matching_tech)}
Technical Matches
{len(matching_soft)}
Soft Skill Matches
{final_score}%
Overall Match

🔒 Zero data retention • 🛡️ Enterprise security • ⚡ Instant analysis

""" return results_html def create_interface(): """Create enhanced Gradio interface""" with gr.Blocks( title="IQKiller - AI Interview Prep with PDF Support", theme=gr.themes.Soft(), css=""" .gradio-container { background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); min-height: 100vh; } .main-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 20px; text-align: center; margin-bottom: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); } .pdf-help { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; padding: 20px; border-radius: 15px; margin: 20px 0; text-align: center; box-shadow: 0 5px 15px rgba(0,0,0,0.1); } """ ) as demo: # Header gr.HTML("""

🎯 IQKiller

AI-Powered Interview Preparation Platform

📄 PDF Support • 🔗 URL Analysis • 💼 Comprehensive Preparation • 💰 Salary Guidance

""") # PDF Help Section gr.HTML("""

📄 Have a PDF Resume?

Extract text from your PDF resume using these simple tools:

Method 1: Script
./extract_pdf_resume.sh
Method 2: Python Tool
python3 pdf_upload_tool.py

Then copy the extracted text and paste it in the resume section below ⬇️

""") # Main Interface with gr.Row(): with gr.Column(): gr.HTML("""

📄 Your Resume

""") resume_input = gr.Textbox( placeholder="""Paste your resume text here... 📋 Include: • Work experience and responsibilities • Technical skills and technologies • Education and certifications • Key projects and achievements • Programming languages and tools • Years of experience in each area 💡 For PDF resumes: Use the extraction tools above first, then paste the text here. Example: Software Engineer with 5 years experience Skills: Python, JavaScript, SQL, React, AWS Led team of 3 developers on e-commerce platform Built scalable applications serving 100k+ users""", lines=14, label="", show_label=False ) with gr.Column(): gr.HTML("""

💼 Job Opportunity

""") job_input = gr.Textbox( placeholder="""🔗 Paste job URL for automatic analysis: • LinkedIn job posts • Company career pages • Job board listings • Indeed, Glassdoor, etc. 📝 Or paste the complete job description: • Company name and role title • Required skills and experience • Responsibilities and duties • Qualifications and requirements • Team info and company culture 🎯 URLs provide the most comprehensive analysis! Example: https://linkedin.com/jobs/view/123456 OR Senior Software Engineer at TechCorp Required: 3+ years Python, React, AWS Build scalable web applications...""", lines=14, label="", show_label=False ) # Main Action Button with gr.Row(): analyze_btn = gr.Button( "🎯 Generate My Comprehensive Interview Guide", variant="primary", size="lg", scale=1 ) # Results results_output = gr.HTML() # Event handler analyze_btn.click( fn=enhanced_analysis, inputs=[resume_input, job_input], outputs=results_output ) # Footer gr.HTML("""

🎯 IQKiller Enhanced v2.0

📄
PDF Support
🔗
URL Analysis
🧠
AI-Powered
Instant Results

🔒 Zero data retention • 🛡️ Enterprise security • 🎯 Professional interview preparation

""") return demo def main(): """Launch the application""" print("🎯 IQKiller Working Version - PDF Support Included") print("=" * 55) print("✅ Starting IQKiller Platform...") print("📄 PDF extraction tools available") print("🔗 URL processing ready") print("💼 Enhanced analysis enabled") print("🌐 Opening at: http://localhost:7860") print("=" * 55) demo = create_interface() demo.launch( server_name="0.0.0.0", server_port=7860, share=False, show_error=True ) if __name__ == "__main__": main()