# Career Prediction Assistant - Advanced Interactive Dashboard # ======================================================= import gradio as gr import pandas as pd import numpy as np import joblib from typing import Dict, List, Tuple import matplotlib.pyplot as plt import matplotlib matplotlib.use('Agg') # مهم ليعمل مع Gradio import json from datetime import datetime import warnings warnings.filterwarnings('ignore') # ==================== # SYSTEM CONFIGURATION # ==================== class Config: # All countries with detailed classification COUNTRIES = { # Arab Countries 'Egypt': {'region': 'Arab', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Saudi Arabia': {'region': 'Arab', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'United Arab Emirates': {'region': 'Arab', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Kuwait': {'region': 'Arab', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Qatar': {'region': 'Arab', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Bahrain': {'region': 'Arab', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Oman': {'region': 'Arab', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Jordan': {'region': 'Arab', 'gdp_tier': 'Upper Middle', 'tech_level': 'Emerging'}, 'Lebanon': {'region': 'Arab', 'gdp_tier': 'Upper Middle', 'tech_level': 'Emerging'}, 'Morocco': {'region': 'Arab', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Tunisia': {'region': 'Arab', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Algeria': {'region': 'Arab', 'gdp_tier': 'Upper Middle', 'tech_level': 'Emerging'}, 'Iraq': {'region': 'Arab', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Yemen': {'region': 'Arab', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Syria': {'region': 'Arab', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Libya': {'region': 'Arab', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Sudan': {'region': 'Arab', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Mauritania': {'region': 'Arab', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, 'Somalia': {'region': 'Arab', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Djibouti': {'region': 'Arab', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Comoros': {'region': 'Arab', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Palestine': {'region': 'Arab', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, # Other Middle East 'Turkey': {'region': 'Middle East', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Iran': {'region': 'Middle East', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Israel': {'region': 'Middle East', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, # Caucasus Region 'Armenia': {'region': 'Caucasus', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Azerbaijan': {'region': 'Caucasus', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Georgia': {'region': 'Caucasus', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, # Central Asia 'Kazakhstan': {'region': 'Central Asia', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Uzbekistan': {'region': 'Central Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Turkmenistan': {'region': 'Central Asia', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Kyrgyzstan': {'region': 'Central Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, 'Tajikistan': {'region': 'Central Asia', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, # South Asia 'India': {'region': 'South Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Developing'}, 'Pakistan': {'region': 'South Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Bangladesh': {'region': 'South Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Sri Lanka': {'region': 'South Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Nepal': {'region': 'South Asia', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Afghanistan': {'region': 'South Asia', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Bhutan': {'region': 'South Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Maldives': {'region': 'South Asia', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, # East Asia 'China': {'region': 'East Asia', 'gdp_tier': 'Upper Middle', 'tech_level': 'Advanced'}, 'Japan': {'region': 'East Asia', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'South Korea': {'region': 'East Asia', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'North Korea': {'region': 'East Asia', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Mongolia': {'region': 'East Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Taiwan': {'region': 'East Asia', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Hong Kong': {'region': 'East Asia', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Macau': {'region': 'East Asia', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, # Southeast Asia 'Indonesia': {'region': 'Southeast Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Developing'}, 'Malaysia': {'region': 'Southeast Asia', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Philippines': {'region': 'Southeast Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Singapore': {'region': 'Southeast Asia', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Thailand': {'region': 'Southeast Asia', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Vietnam': {'region': 'Southeast Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Myanmar': {'region': 'Southeast Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Cambodia': {'region': 'Southeast Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Laos': {'region': 'Southeast Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Brunei': {'region': 'Southeast Asia', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Timor-Leste': {'region': 'Southeast Asia', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, # Europe 'United Kingdom': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Germany': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'France': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Italy': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Spain': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Advanced'}, 'Portugal': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Netherlands': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Belgium': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Switzerland': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Sweden': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Norway': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Denmark': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Finland': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Ireland': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Austria': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Greece': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Poland': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Czech Republic': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Hungary': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Romania': {'region': 'Europe', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Bulgaria': {'region': 'Europe', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Croatia': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Serbia': {'region': 'Europe', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Slovakia': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Slovenia': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Estonia': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Latvia': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Lithuania': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Ukraine': {'region': 'Europe', 'gdp_tier': 'Lower Middle', 'tech_level': 'Developing'}, 'Belarus': {'region': 'Europe', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Moldova': {'region': 'Europe', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Russia': {'region': 'Europe', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Cyprus': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Malta': {'region': 'Europe', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Iceland': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Luxembourg': {'region': 'Europe', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, # Africa (Non-Arab) 'South Africa': {'region': 'Africa', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Nigeria': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Kenya': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Ethiopia': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Emerging'}, 'Ghana': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Tanzania': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Emerging'}, 'Uganda': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Emerging'}, 'Rwanda': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Emerging'}, 'Zimbabwe': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Zambia': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Mozambique': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Angola': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Developing'}, 'Botswana': {'region': 'Africa', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Namibia': {'region': 'Africa', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Senegal': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Ivory Coast': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Cameroon': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'DR Congo': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Madagascar': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Mali': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Burkina Faso': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Niger': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Chad': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Guinea': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Benin': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Togo': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Sierra Leone': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Liberia': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Central African Republic': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Congo': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, 'Gabon': {'region': 'Africa', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Equatorial Guinea': {'region': 'Africa', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Burundi': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Eritrea': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'South Sudan': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Mauritius': {'region': 'Africa', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Seychelles': {'region': 'Africa', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Cape Verde': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Developing'}, 'Gambia': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Guinea-Bissau': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Comoros': {'region': 'Africa', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'São Tomé and Príncipe': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Eswatini': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Developing'}, 'Lesotho': {'region': 'Africa', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, # Americas 'United States': {'region': 'North America', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Canada': {'region': 'North America', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Mexico': {'region': 'North America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Brazil': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Argentina': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Colombia': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Chile': {'region': 'South America', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Peru': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Venezuela': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Ecuador': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Bolivia': {'region': 'South America', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Paraguay': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Emerging'}, 'Uruguay': {'region': 'South America', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Guyana': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Emerging'}, 'Suriname': {'region': 'South America', 'gdp_tier': 'Upper Middle', 'tech_level': 'Emerging'}, 'French Guiana': {'region': 'South America', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Cuba': {'region': 'Caribbean', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Dominican Republic': {'region': 'Caribbean', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Haiti': {'region': 'Caribbean', 'gdp_tier': 'Low', 'tech_level': 'Basic'}, 'Jamaica': {'region': 'Caribbean', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Puerto Rico': {'region': 'Caribbean', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Trinidad and Tobago': {'region': 'Caribbean', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Bahamas': {'region': 'Caribbean', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Barbados': {'region': 'Caribbean', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Saint Lucia': {'region': 'Caribbean', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Grenada': {'region': 'Caribbean', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Saint Vincent and the Grenadines': {'region': 'Caribbean', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Antigua and Barbuda': {'region': 'Caribbean', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Dominica': {'region': 'Caribbean', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Saint Kitts and Nevis': {'region': 'Caribbean', 'gdp_tier': 'High', 'tech_level': 'Developing'}, # Oceania 'Australia': {'region': 'Oceania', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'New Zealand': {'region': 'Oceania', 'gdp_tier': 'Very High', 'tech_level': 'Advanced'}, 'Fiji': {'region': 'Oceania', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Papua New Guinea': {'region': 'Oceania', 'gdp_tier': 'Lower Middle', 'tech_level': 'Emerging'}, 'Solomon Islands': {'region': 'Oceania', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, 'Vanuatu': {'region': 'Oceania', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, 'Samoa': {'region': 'Oceania', 'gdp_tier': 'Lower Middle', 'tech_level': 'Developing'}, 'Kiribati': {'region': 'Oceania', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, 'Tonga': {'region': 'Oceania', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Micronesia': {'region': 'Oceania', 'gdp_tier': 'Lower Middle', 'tech_level': 'Basic'}, 'Marshall Islands': {'region': 'Oceania', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, 'Palau': {'region': 'Oceania', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Nauru': {'region': 'Oceania', 'gdp_tier': 'High', 'tech_level': 'Developing'}, 'Tuvalu': {'region': 'Oceania', 'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}, } # Career categories with detailed majors CAREER_CATEGORIES = { 'Technology': [ 'Computer Science', 'Software Engineering', 'Information Technology', 'Data Science', 'Artificial Intelligence', 'Cybersecurity', 'Cloud Computing', 'Machine Learning', 'Computer Engineering', 'Information Systems', 'Web Development', 'Mobile App Development', 'DevOps Engineering', 'UI/UX Design', 'Game Development', 'Blockchain Development', 'IoT Engineering', 'Robotics', 'Quantum Computing', 'Bioinformatics' ], 'Engineering': [ 'Electrical Engineering', 'Mechanical Engineering', 'Civil Engineering', 'Chemical Engineering', 'Biomedical Engineering', 'Aerospace Engineering', 'Petroleum Engineering', 'Telecommunications Engineering', 'Industrial Engineering', 'Environmental Engineering', 'Materials Engineering', 'Nuclear Engineering', 'Marine Engineering', 'Automotive Engineering', 'Mining Engineering', 'Geotechnical Engineering', 'Structural Engineering', 'Renewable Energy Engineering' ], 'Business': [ 'Business Administration', 'Finance', 'Accounting', 'Marketing', 'International Business', 'Supply Chain Management', 'Human Resources', 'Business Analytics', 'Entrepreneurship', 'Project Management', 'Digital Marketing', 'Financial Analysis', 'Risk Management', 'Investment Banking', 'Management Consulting', 'Corporate Finance', 'Sales Management', 'Operations Management', 'Strategic Management', 'E-commerce Management' ], 'Healthcare': [ 'Medicine', 'Nursing', 'Pharmacy', 'Dentistry', 'Biotechnology', 'Public Health', 'Medical Laboratory Sciences', 'Physiotherapy', 'Medical Imaging', 'Healthcare Administration', 'Nutrition', 'Medical Research', 'Clinical Psychology', 'Veterinary Medicine', 'Epidemiology', 'Pharmaceutical Sciences', 'Medical Technology', 'Health Informatics', 'Occupational Therapy' ], 'Science': [ 'Physics', 'Chemistry', 'Biology', 'Mathematics', 'Statistics', 'Environmental Science', 'Geology', 'Astronomy', 'Biochemistry', 'Molecular Biology', 'Genetics', 'Microbiology', 'Neuroscience', 'Materials Science', 'Oceanography', 'Atmospheric Science', 'Agricultural Science', 'Food Science', 'Forensic Science' ], 'Humanities': [ 'Psychology', 'Economics', 'Political Science', 'Sociology', 'Law', 'International Relations', 'Education', 'History', 'Philosophy', 'Literature', 'Linguistics', 'Anthropology', 'Archaeology', 'Media Studies', 'Journalism', 'Fine Arts', 'Music', 'Theater Arts', 'Cultural Studies' ] } # Experience levels EXPERIENCE_LEVELS = { 'Intern/Student (0-1 years)': (0, 1), 'Entry Level (1-3 years)': (1, 3), 'Junior (3-5 years)': (3, 5), 'Mid Level (5-8 years)': (5, 8), 'Senior (8-12 years)': (8, 12), 'Lead (12-15 years)': (12, 15), 'Principal (15-20 years)': (15, 20), 'Executive/Director (20+ years)': (20, 40) } # Company sizes COMPANY_SIZES = [ 'Startup (1-10 employees)', 'Small (11-50)', 'Medium (51-200)', 'Large (201-1000)', 'Corporate (1001-5000)', 'Enterprise (5000+)', 'Multinational (10000+)' ] # GDP Tier multipliers for salary calculation GDP_TIER_MULTIPLIERS = { 'Very High': 1.8, # USA, UK, Germany, etc. 'High': 1.4, # Saudi Arabia, UAE, etc. 'Upper Middle': 1.0, # Turkey, China, Brazil, etc. 'Lower Middle': 0.7, # Egypt, India, etc. 'Low': 0.4 # Yemen, Afghanistan, etc. } # Tech Level multipliers TECH_LEVEL_MULTIPLIERS = { 'Advanced': 1.3, # Silicon Valley level 'Developing': 1.1, # Growing tech hubs 'Emerging': 1.0, # Basic tech infrastructure 'Basic': 0.7 # Limited tech access } # ==================== # DATA MANAGER # ==================== class DataManager: def __init__(self): self.companies_db = self.load_companies_database() self.salary_data = self.load_salary_benchmarks() self.skills_data = self.load_skills_data() def load_companies_database(self) -> pd.DataFrame: """Load comprehensive global companies database""" companies_data = [] # Tech Companies (Global) tech_companies = [ # USA ('Google', 'USA', 'Technology', 'Multinational (10000+)', 'Actively Hiring', 2.0, 95), ('Microsoft', 'USA', 'Technology', 'Multinational (10000+)', 'Selective Hiring', 1.9, 92), ('Apple', 'USA', 'Technology', 'Multinational (10000+)', 'Selective Hiring', 2.1, 94), ('Amazon', 'USA', 'E-commerce', 'Multinational (10000+)', 'Actively Hiring', 1.8, 90), ('Meta', 'USA', 'Technology', 'Multinational (10000+)', 'Moderate Hiring', 1.9, 91), ('IBM', 'USA', 'Technology', 'Enterprise (5000+)', 'Selective Hiring', 1.6, 85), ('Oracle', 'USA', 'Technology', 'Enterprise (5000+)', 'Moderate Hiring', 1.7, 86), ('Intel', 'USA', 'Semiconductors', 'Enterprise (5000+)', 'Selective Hiring', 1.8, 88), ('NVIDIA', 'USA', 'Technology', 'Enterprise (5000+)', 'Actively Hiring', 2.2, 96), ('Tesla', 'USA', 'Automotive/Tech', 'Enterprise (5000+)', 'Actively Hiring', 1.9, 92), # Europe ('SAP', 'Germany', 'Enterprise Software', 'Enterprise (5000+)', 'Actively Hiring', 1.5, 87), ('Spotify', 'Sweden', 'Technology', 'Large (201-1000)', 'Moderate Hiring', 1.7, 89), ('Siemens', 'Germany', 'Industrial Tech', 'Multinational (10000+)', 'Selective Hiring', 1.6, 85), ('Ericsson', 'Sweden', 'Telecom', 'Enterprise (5000+)', 'Moderate Hiring', 1.5, 84), ('ARM', 'UK', 'Semiconductors', 'Medium (51-200)', 'Selective Hiring', 1.8, 90), # Asia ('Samsung', 'South Korea', 'Electronics', 'Multinational (10000+)', 'Actively Hiring', 1.7, 88), ('Tencent', 'China', 'Technology', 'Multinational (10000+)', 'Actively Hiring', 1.8, 89), ('Alibaba', 'China', 'E-commerce', 'Multinational (10000+)', 'Moderate Hiring', 1.7, 87), ('Baidu', 'China', 'Technology', 'Enterprise (5000+)', 'Selective Hiring', 1.6, 86), ('Rakuten', 'Japan', 'E-commerce', 'Enterprise (5000+)', 'Moderate Hiring', 1.5, 85), # Arab Tech Companies ('Careem', 'UAE', 'Technology', 'Large (201-1000)', 'Actively Hiring', 1.6, 88), ('Souq.com', 'UAE', 'E-commerce', 'Large (201-1000)', 'Moderate Hiring', 1.5, 86), ('Noon', 'UAE', 'E-commerce', 'Enterprise (5000+)', 'Actively Hiring', 1.7, 87), ('Mawdoo3', 'Jordan', 'Technology', 'Medium (51-200)', 'Moderate Hiring', 1.3, 82), ('Talal Abu-Ghazaleh', 'Jordan', 'Professional Services', 'Large (201-1000)', 'Selective Hiring', 1.4, 83), ('STC Solutions', 'Saudi Arabia', 'Technology', 'Enterprise (5000+)', 'Actively Hiring', 1.6, 85), ('Elmenus', 'Egypt', 'Technology', 'Medium (51-200)', 'Actively Hiring', 1.4, 84), ('Vezeeta', 'Egypt', 'Health Tech', 'Medium (51-200)', 'Moderate Hiring', 1.5, 86), ('Swvl', 'Egypt', 'Transport Tech', 'Medium (51-200)', 'Moderate Hiring', 1.6, 87), ('Fetchr', 'UAE', 'Logistics Tech', 'Medium (51-200)', 'Actively Hiring', 1.5, 85), ] # Oil & Gas Companies oil_companies = [ ('Saudi Aramco', 'Saudi Arabia', 'Oil & Gas', 'Multinational (10000+)', 'Selective Hiring', 2.3, 90), ('Qatar Petroleum', 'Qatar', 'Oil & Gas', 'Enterprise (5000+)', 'Selective Hiring', 2.2, 89), ('ADNOC', 'UAE', 'Oil & Gas', 'Enterprise (5000+)', 'Actively Hiring', 2.1, 88), ('Kuwait Petroleum', 'Kuwait', 'Oil & Gas', 'Enterprise (5000+)', 'Moderate Hiring', 2.0, 87), ('Bapco', 'Bahrain', 'Oil & Gas', 'Large (201-1000)', 'Selective Hiring', 1.9, 86), ('Sonatrach', 'Algeria', 'Oil & Gas', 'Enterprise (5000+)', 'Moderate Hiring', 1.8, 85), ('ENI', 'Italy', 'Oil & Gas', 'Multinational (10000+)', 'Selective Hiring', 1.7, 88), ('ExxonMobil', 'USA', 'Oil & Gas', 'Multinational (10000+)', 'Moderate Hiring', 1.9, 89), ('Shell', 'Netherlands', 'Oil & Gas', 'Multinational (10000+)', 'Selective Hiring', 1.8, 88), ('BP', 'UK', 'Oil & Gas', 'Multinational (10000+)', 'Moderate Hiring', 1.7, 87), ] # Banking & Finance finance_companies = [ ('QNB', 'Qatar', 'Banking', 'Enterprise (5000+)', 'Actively Hiring', 1.8, 87), ('Emirates NBD', 'UAE', 'Banking', 'Enterprise (5000+)', 'Moderate Hiring', 1.7, 86), ('Al Rajhi Bank', 'Saudi Arabia', 'Banking', 'Enterprise (5000+)', 'Selective Hiring', 1.9, 88), ('Arab Bank', 'Jordan', 'Banking', 'Enterprise (5000+)', 'Moderate Hiring', 1.6, 85), ('National Bank of Egypt', 'Egypt', 'Banking', 'Multinational (10000+)', 'Actively Hiring', 1.5, 84), ('Attijariwafa Bank', 'Morocco', 'Banking', 'Enterprise (5000+)', 'Moderate Hiring', 1.4, 83), ('Bank of China', 'China', 'Banking', 'Multinational (10000+)', 'Actively Hiring', 1.6, 86), ('HSBC', 'UK', 'Banking', 'Multinational (10000+)', 'Selective Hiring', 1.7, 87), ('Goldman Sachs', 'USA', 'Investment Banking', 'Enterprise (5000+)', 'Selective Hiring', 2.2, 92), ('JP Morgan', 'USA', 'Banking', 'Multinational (10000+)', 'Moderate Hiring', 2.0, 90), ] # Telecommunications telecom_companies = [ ('STC', 'Saudi Arabia', 'Telecommunications', 'Multinational (10000+)', 'Actively Hiring', 1.7, 86), ('Etisalat', 'UAE', 'Telecommunications', 'Enterprise (5000+)', 'Moderate Hiring', 1.8, 87), ('Zain', 'Kuwait', 'Telecommunications', 'Enterprise (5000+)', 'Actively Hiring', 1.6, 85), ('Ooredoo', 'Qatar', 'Telecommunications', 'Enterprise (5000+)', 'Moderate Hiring', 1.7, 86), ('Orange', 'France', 'Telecommunications', 'Multinational (10000+)', 'Selective Hiring', 1.5, 85), ('Vodafone', 'UK', 'Telecommunications', 'Multinational (10000+)', 'Moderate Hiring', 1.6, 86), ('China Mobile', 'China', 'Telecommunications', 'Multinational (10000+)', 'Actively Hiring', 1.4, 84), ('AT&T', 'USA', 'Telecommunications', 'Multinational (10000+)', 'Selective Hiring', 1.7, 87), ] # Healthcare healthcare_companies = [ ('King Faisal Specialist Hospital', 'Saudi Arabia', 'Healthcare', 'Enterprise (5000+)', 'Actively Hiring', 1.8, 88), ('Cleveland Clinic Abu Dhabi', 'UAE', 'Healthcare', 'Large (201-1000)', 'Selective Hiring', 1.9, 89), ('American Hospital Dubai', 'UAE', 'Healthcare', 'Medium (51-200)', 'Moderate Hiring', 1.7, 87), ('Saudi German Hospital', 'Saudi Arabia', 'Healthcare', 'Large (201-1000)', 'Actively Hiring', 1.6, 86), ('Kasr Al Ainy Hospital', 'Egypt', 'Healthcare', 'Enterprise (5000+)', 'Actively Hiring', 1.3, 83), ('Mayo Clinic', 'USA', 'Healthcare', 'Multinational (10000+)', 'Selective Hiring', 2.0, 92), ('Johns Hopkins Hospital', 'USA', 'Healthcare', 'Enterprise (5000+)', 'Selective Hiring', 1.9, 91), ] # Aviation aviation_companies = [ ('Emirates Airlines', 'UAE', 'Aviation', 'Enterprise (5000+)', 'Actively Hiring', 1.8, 88), ('Qatar Airways', 'Qatar', 'Aviation', 'Enterprise (5000+)', 'Moderate Hiring', 1.9, 89), ('Saudi Airlines', 'Saudi Arabia', 'Aviation', 'Enterprise (5000+)', 'Actively Hiring', 1.7, 87), ('EgyptAir', 'Egypt', 'Aviation', 'Large (201-1000)', 'Moderate Hiring', 1.4, 84), ('Royal Jordanian', 'Jordan', 'Aviation', 'Medium (51-200)', 'Selective Hiring', 1.5, 85), ] # Construction & Engineering construction_companies = [ ('Saudi Binladin Group', 'Saudi Arabia', 'Construction', 'Multinational (10000+)', 'Actively Hiring', 1.6, 85), ('Arabtec', 'UAE', 'Construction', 'Enterprise (5000+)', 'Moderate Hiring', 1.5, 84), ('ACC', 'India', 'Construction', 'Enterprise (5000+)', 'Actively Hiring', 1.4, 83), ('Bechtel', 'USA', 'Engineering', 'Multinational (10000+)', 'Selective Hiring', 1.8, 88), ('Fluor', 'USA', 'Engineering', 'Enterprise (5000+)', 'Moderate Hiring', 1.7, 87), ] # Add all companies to list all_companies = (tech_companies + oil_companies + finance_companies + telecom_companies + healthcare_companies + aviation_companies + construction_companies) # Convert to DataFrame companies_df = pd.DataFrame(all_companies, columns=[ 'company_name', 'country', 'industry', 'company_size', 'hiring_status', 'avg_salary_multiplier', 'career_growth_score' ]) # Add more companies from different countries additional_companies = [] # Add companies for countries not covered for country in Config.COUNTRIES: if country not in companies_df['country'].unique(): # Add representative companies for each country country_info = Config.COUNTRIES[country] if country_info['tech_level'] in ['Advanced', 'Developing']: # Add tech company additional_companies.append(( f'{country} Tech Solutions', country, 'Technology', 'Medium (51-200)', 'Actively Hiring', 1.3 + (0.1 if country_info['gdp_tier'] in ['Very High', 'High'] else 0), 75 + (10 if country_info['tech_level'] == 'Advanced' else 5) )) # Add major local company additional_companies.append(( f'National {country} Corporation', country, 'Various', 'Large (201-1000)', 'Moderate Hiring', 1.2, 70 )) if additional_companies: additional_df = pd.DataFrame(additional_companies, columns=companies_df.columns) companies_df = pd.concat([companies_df, additional_df], ignore_index=True) return companies_df def load_salary_benchmarks(self) -> pd.DataFrame: """Generate comprehensive salary benchmarks""" data = [] for country, info in Config.COUNTRIES.items(): for category, majors in Config.CAREER_CATEGORIES.items(): # Base salary based on GDP tier base_salaries = { 'Very High': 80000, 'High': 60000, 'Upper Middle': 40000, 'Lower Middle': 25000, 'Low': 15000 } base = base_salaries[info['gdp_tier']] # Category multipliers category_multipliers = { 'Technology': 1.6, 'Engineering': 1.5, 'Healthcare': 1.7, 'Business': 1.4, 'Science': 1.2, 'Humanities': 1.0 } avg_salary = base * category_multipliers[category] # Tech level adjustment tech_multipliers = { 'Advanced': 1.2, 'Developing': 1.0, 'Emerging': 0.9, 'Basic': 0.8 } avg_salary *= tech_multipliers[info['tech_level']] data.append({ 'country': country, 'career_category': category, 'avg_salary': int(avg_salary), 'min_salary': int(avg_salary * 0.7), 'max_salary': int(avg_salary * 1.4), 'demand_level': np.random.choice(['Very High', 'High', 'Medium', 'Low'], p=[0.2, 0.3, 0.4, 0.1]), 'gdp_tier': info['gdp_tier'], 'tech_level': info['tech_level'] }) return pd.DataFrame(data) def load_skills_data(self) -> Dict: """Load detailed skills demand data""" return { 'Technology': { 'programming_languages': ['Python', 'JavaScript', 'Java', 'C++', 'C#', 'Go', 'Rust', 'Swift', 'Kotlin'], 'frameworks': ['React', 'Angular', 'Vue.js', 'Node.js', 'Django', 'Spring', '.NET'], 'databases': ['SQL', 'MySQL', 'PostgreSQL', 'MongoDB', 'Redis', 'Cassandra'], 'cloud_platforms': ['AWS', 'Azure', 'Google Cloud', 'IBM Cloud'], 'devops_tools': ['Docker', 'Kubernetes', 'Jenkins', 'Git', 'Terraform', 'Ansible'], 'ai_ml': ['TensorFlow', 'PyTorch', 'Scikit-learn', 'OpenCV', 'NLP', 'Computer Vision'], 'cybersecurity': ['Network Security', 'Ethical Hacking', 'Cryptography', 'Security Analysis'], 'soft_skills': ['Problem Solving', 'Teamwork', 'Communication', 'Adaptability'] }, 'Engineering': { 'technical_skills': ['CAD/CAM', 'AutoCAD', 'SolidWorks', 'MATLAB', 'Simulink', 'PLC Programming'], 'analysis_tools': ['Finite Element Analysis', 'Computational Fluid Dynamics', 'Statistical Analysis'], 'project_management': ['Agile', 'Scrum', 'Waterfall', 'Risk Management', 'Budgeting'], 'industry_specific': ['Six Sigma', 'Lean Manufacturing', 'Quality Control', 'Safety Standards'], 'soft_skills': ['Leadership', 'Technical Writing', 'Presentation Skills', 'Critical Thinking'] }, 'Business': { 'analytical_skills': ['Financial Modeling', 'Data Analysis', 'Market Research', 'Business Intelligence'], 'digital_skills': ['Digital Marketing', 'SEO/SEM', 'Social Media Marketing', 'Google Analytics'], 'management_skills': ['Strategic Planning', 'Project Management', 'Team Leadership', 'Conflict Resolution'], 'financial_skills': ['Financial Reporting', 'Investment Analysis', 'Risk Assessment', 'Budget Management'], 'soft_skills': ['Negotiation', 'Networking', 'Public Speaking', 'Time Management'] }, 'Healthcare': { 'clinical_skills': ['Patient Assessment', 'Medical Procedures', 'Diagnostic Testing', 'Treatment Planning'], 'technical_skills': ['Medical Imaging', 'Laboratory Techniques', 'Electronic Health Records'], 'research_skills': ['Clinical Research', 'Data Analysis', 'Scientific Writing', 'Grant Writing'], 'management_skills': ['Healthcare Administration', 'Quality Assurance', 'Regulatory Compliance'], 'soft_skills': ['Empathy', 'Communication', 'Attention to Detail', 'Stress Management'] }, 'Science': { 'research_skills': ['Experimental Design', 'Data Collection', 'Statistical Analysis', 'Scientific Writing'], 'laboratory_skills': ['Chemical Analysis', 'Microscopy', 'Spectroscopy', 'Chromatography'], 'computational_skills': ['Python/R Programming', 'Data Visualization', 'Simulation Modeling'], 'fieldwork_skills': ['Sample Collection', 'Environmental Monitoring', 'Geological Surveying'], 'soft_skills': ['Critical Thinking', 'Problem Solving', 'Collaboration', 'Scientific Communication'] }, 'Humanities': { 'research_skills': ['Qualitative Analysis', 'Historical Research', 'Literary Analysis', 'Case Studies'], 'analytical_skills': ['Critical Analysis', 'Logical Reasoning', 'Argument Development', 'Text Interpretation'], 'communication_skills': ['Academic Writing', 'Public Speaking', 'Editing', 'Translation'], 'digital_skills': ['Digital Archives', 'Content Management', 'Social Media Analysis'], 'soft_skills': ['Cultural Awareness', 'Ethical Reasoning', 'Creativity', 'Interpersonal Skills'] } } # ==================== # PREDICTION ENGINE # ==================== class PredictionEngine: def __init__(self, data_manager: DataManager): self.dm = data_manager def predict_salary(self, inputs: Dict) -> Dict: """Predict salary based on multiple factors with detailed calculation""" try: country = inputs['country'] major = inputs['major'] gpa = float(inputs['gpa']) experience_years = float(inputs['experience_years']) has_linkedin = inputs['has_linkedin'] num_courses = int(inputs['num_courses']) skills_input = inputs['skills'] # Get country info country_info = Config.COUNTRIES.get(country, {'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}) # Get base salary base_salary = self.get_base_salary(country, major) # Apply detailed modifiers salary = base_salary # 1. GPA modifier (detailed) if gpa >= 3.8: gpa_modifier = 1.15 gpa_level = "Excellent" elif gpa >= 3.5: gpa_modifier = 1.10 gpa_level = "Very Good" elif gpa >= 3.0: gpa_modifier = 1.05 gpa_level = "Good" elif gpa >= 2.5: gpa_modifier = 1.0 gpa_level = "Average" else: gpa_modifier = 0.9 gpa_level = "Below Average" salary *= gpa_modifier # 2. Experience modifier (detailed curve) if experience_years <= 1: exp_modifier = 1.0 exp_level = "Entry" elif experience_years <= 3: exp_modifier = 1.15 exp_level = "Junior" elif experience_years <= 5: exp_modifier = 1.35 exp_level = "Mid" elif experience_years <= 8: exp_modifier = 1.60 exp_level = "Senior" elif experience_years <= 12: exp_modifier = 1.90 exp_level = "Lead" elif experience_years <= 15: exp_modifier = 2.20 exp_level = "Principal" else: exp_modifier = 2.50 exp_level = "Executive" salary *= min(exp_modifier, 3.0) # Cap at 3x # 3. LinkedIn premium (detailed) if has_linkedin == "Yes": linkedin_modifier = 1.12 linkedin_impact = "High visibility" else: linkedin_modifier = 1.0 linkedin_impact = "Limited visibility" salary *= linkedin_modifier # 4. Courses modifier if num_courses == 0: courses_modifier = 1.0 courses_impact = "No certifications" elif num_courses <= 3: courses_modifier = 1.05 courses_impact = "Basic certifications" elif num_courses <= 6: courses_modifier = 1.10 courses_impact = "Moderate certifications" elif num_courses <= 10: courses_modifier = 1.15 courses_impact = "Good certifications" else: courses_modifier = 1.20 courses_impact = "Excellent certifications" salary *= courses_modifier # 5. Skills impact if skills_input and len(skills_input.strip()) > 0: skills_list = [s.strip() for s in skills_input.split(',')] skills_count = len(skills_list) skills_modifier = 1 + (skills_count * 0.02) skills_impact = f"{skills_count} skills listed" else: skills_modifier = 1.0 skills_impact = "No skills specified" salary *= skills_modifier # 6. Country-specific adjustments country_modifier = Config.GDP_TIER_MULTIPLIERS.get(country_info['gdp_tier'], 1.0) salary *= country_modifier # 7. Tech level adjustment tech_modifier = Config.TECH_LEVEL_MULTIPLIERS.get(country_info['tech_level'], 1.0) salary *= tech_modifier # Add some realistic randomness salary *= np.random.uniform(0.92, 1.08) # Calculate range salary_low = int(salary * 0.88) salary_high = int(salary * 1.15) # Confidence score based on data completeness confidence_factors = [] if gpa >= 3.0: confidence_factors.append(0.9) else: confidence_factors.append(0.7) if experience_years >= 1: confidence_factors.append(0.85) else: confidence_factors.append(0.6) if has_linkedin == "Yes": confidence_factors.append(0.9) else: confidence_factors.append(0.7) if num_courses >= 3: confidence_factors.append(0.8) else: confidence_factors.append(0.6) confidence_score = np.mean(confidence_factors) return { 'predicted_salary': int(salary), 'salary_range': f"${salary_low:,} - ${salary_high:,}", 'currency': 'USD', 'confidence_score': confidence_score, 'gpa_level': gpa_level, 'exp_level': exp_level, 'linkedin_impact': linkedin_impact, 'courses_impact': courses_impact, 'skills_impact': skills_impact, 'country_tier': country_info['gdp_tier'], 'tech_level': country_info['tech_level'] } except Exception as e: print(f"Salary prediction error: {e}") import traceback traceback.print_exc() return { 'predicted_salary': 50000, 'salary_range': "$40,000 - $65,000", 'currency': 'USD', 'confidence_score': 0.5, 'gpa_level': "Average", 'exp_level': "Mid", 'linkedin_impact': "Unknown", 'courses_impact': "Unknown", 'skills_impact': "Unknown", 'country_tier': "Upper Middle", 'tech_level': "Developing" } def get_base_salary(self, country: str, major: str) -> float: """Get base salary for country and major with detailed lookup""" # Find career category career_category = None for category, majors in Config.CAREER_CATEGORIES.items(): if major in majors: career_category = category break if career_category is None: career_category = 'Technology' # Default # Get salary benchmark benchmark = self.dm.salary_data[ (self.dm.salary_data['country'] == country) & (self.dm.salary_data['career_category'] == career_category) ] if not benchmark.empty: return benchmark.iloc[0]['avg_salary'] # Default calculation country_info = Config.COUNTRIES.get(country, {'gdp_tier': 'Upper Middle', 'tech_level': 'Developing'}) base_salaries = { 'Very High': 70000, 'High': 55000, 'Upper Middle': 35000, 'Lower Middle': 22000, 'Low': 12000 } base = base_salaries[country_info['gdp_tier']] category_multipliers = { 'Technology': 1.6, 'Engineering': 1.5, 'Healthcare': 1.7, 'Business': 1.4, 'Science': 1.2, 'Humanities': 1.0 } return base * category_multipliers[career_category] def find_matching_companies(self, inputs: Dict, top_n: int = 7) -> List[Dict]: """Find companies matching user profile with detailed scoring""" try: country = inputs['country'] major = inputs['major'] experience_years = float(inputs['experience_years']) # Get career category career_category = None for category, majors in Config.CAREER_CATEGORIES.items(): if major in majors: career_category = category break if career_category is None: career_category = 'Technology' # Filter companies if country in self.dm.companies_db['country'].unique(): country_companies = self.dm.companies_db[ self.dm.companies_db['country'] == country ] else: # Find companies in similar countries country_info = Config.COUNTRIES.get(country, {'region': 'Global', 'gdp_tier': 'Upper Middle'}) similar_countries = [ c for c, info in Config.COUNTRIES.items() if info['region'] == country_info['region'] and info['gdp_tier'] == country_info['gdp_tier'] ][:5] if not similar_countries: similar_countries = ['USA', 'UK', 'UAE', 'Saudi Arabia'] country_companies = self.dm.companies_db[ self.dm.companies_db['country'].isin(similar_countries) ] # Calculate detailed match scores matches = [] for _, company in country_companies.iterrows(): score_details = self.calculate_detailed_match_score(company, inputs, career_category) total_score = score_details['total_score'] # Calculate expected salary at this company base_salary = self.get_base_salary(company['country'], major) expected_salary = int(base_salary * company['avg_salary_multiplier']) matches.append({ 'company_name': company['company_name'], 'country': company['country'], 'industry': company['industry'], 'company_size': company['company_size'], 'hiring_status': company['hiring_status'], 'match_score': total_score, 'career_growth_score': company['career_growth_score'], 'salary_multiplier': company['avg_salary_multiplier'], 'expected_salary': expected_salary, 'score_breakdown': score_details }) # Sort and return matches.sort(key=lambda x: x['match_score'], reverse=True) return matches[:top_n] except Exception as e: print(f"Company matching error: {e}") import traceback traceback.print_exc() return [] def calculate_detailed_match_score(self, company: pd.Series, inputs: Dict, career_category: str) -> Dict: """Calculate detailed match score with breakdown""" scores = { 'industry_fit': 0, 'experience_fit': 0, 'company_size_fit': 0, 'hiring_status': 0, 'growth_potential': 0, 'total_score': 0 } experience_years = float(inputs['experience_years']) major = inputs['major'] # 1. Industry Fit (0-30 points) industry_fit_score = 0 # Major to industry mapping industry_mapping = { 'Technology': ['Technology', 'E-commerce', 'Telecommunications', 'Enterprise Software'], 'Engineering': ['Engineering', 'Construction', 'Oil & Gas', 'Industrial Tech', 'Automotive/Tech'], 'Business': ['Banking', 'Finance', 'Consulting', 'Professional Services', 'E-commerce'], 'Healthcare': ['Healthcare', 'Health Tech'], 'Science': ['Various', 'Technology', 'Research'], 'Humanities': ['Various', 'Media', 'Education', 'Consulting'] } target_industries = industry_mapping.get(career_category, ['Various']) if company['industry'] in target_industries: industry_fit_score = 25 elif any(keyword.lower() in company['industry'].lower() for keyword in ['tech', 'digital', 'software']): industry_fit_score = 20 else: industry_fit_score = 10 scores['industry_fit'] = industry_fit_score # 2. Experience Fit (0-25 points) company_size = company['company_size'] if experience_years < 2: # Entry level - better fit with startups and small companies if 'Startup' in company_size or 'Small' in company_size: experience_fit_score = 22 elif 'Medium' in company_size: experience_fit_score = 18 else: experience_fit_score = 12 elif experience_years < 5: # Junior level if 'Medium' in company_size or 'Small' in company_size: experience_fit_score = 23 elif 'Large' in company_size: experience_fit_score = 20 else: experience_fit_score = 15 elif experience_years < 8: # Mid level if 'Large' in company_size or 'Corporate' in company_size: experience_fit_score = 24 elif 'Medium' in company_size: experience_fit_score = 22 else: experience_fit_score = 18 else: # Senior level if 'Enterprise' in company_size or 'Multinational' in company_size: experience_fit_score = 25 elif 'Corporate' in company_size: experience_fit_score = 23 else: experience_fit_score = 20 scores['experience_fit'] = experience_fit_score # 3. Company Size Fit (0-15 points) size_fit_score = 0 if experience_years < 3 and ('Startup' in company_size or 'Small' in company_size): size_fit_score = 14 elif 3 <= experience_years < 8 and ('Medium' in company_size or 'Large' in company_size): size_fit_score = 13 elif experience_years >= 8 and ('Enterprise' in company_size or 'Multinational' in company_size): size_fit_score = 15 else: size_fit_score = 10 scores['company_size_fit'] = size_fit_score # 4. Hiring Status (0-20 points) hiring_score = { 'Actively Hiring': 20, 'Moderate Hiring': 15, 'Selective Hiring': 10, 'Not Hiring': 0 }.get(company['hiring_status'], 10) scores['hiring_status'] = hiring_score # 5. Growth Potential (0-10 points) growth_score = min(int(company['career_growth_score'] / 10), 10) scores['growth_potential'] = growth_score # Calculate total score total_score = sum([ scores['industry_fit'], scores['experience_fit'], scores['company_size_fit'], scores['hiring_status'], scores['growth_potential'] ]) scores['total_score'] = min(total_score, 100) return scores # ==================== # VISUALIZATION ENGINE (Matplotlib) # ==================== class VisualizationEngine: @staticmethod def create_salary_comparison_chart(predicted_salary: int, benchmark_salaries: Dict, country: str, major: str): """Create detailed salary comparison chart using Matplotlib""" # إنشاء الشكل plt.figure(figsize=(10, 6)) # إعداد البيانات categories = list(benchmark_salaries.keys()) salaries = list(benchmark_salaries.values()) # إنشاء الألوان colors = ['#3498db', '#2ecc71', '#e74c3c', '#f39c12', '#9b59b6'] # رسم الأعمدة bars = plt.bar(categories, salaries, color=colors, alpha=0.8, edgecolor='black', linewidth=1) # رسم خط الراتب المتوقع plt.axhline(y=predicted_salary, color='red', linestyle='--', linewidth=3, label=f'Your Prediction: ${predicted_salary:,}') # إضافة النصوص على الأعمدة for bar, salary in zip(bars, salaries): height = bar.get_height() plt.text(bar.get_x() + bar.get_width()/2., height + 0.05*max(salaries), f'${salary:,}', ha='center', va='bottom', fontsize=10, fontweight='bold') # تخصيص الرسم plt.title(f'Salary Analysis: {major} in {country}', fontsize=16, fontweight='bold', pad=20) plt.xlabel('Salary Categories', fontsize=12) plt.ylabel('Annual Salary (USD)', fontsize=12) plt.legend(loc='upper left') plt.grid(axis='y', alpha=0.3, linestyle='--') plt.ylim(0, max(salaries) * 1.2) # تنسيق المحور Y plt.gca().yaxis.set_major_formatter(plt.FuncFormatter(lambda x, p: f'${x:,.0f}')) # تدوير تسميات المحور X plt.xticks(rotation=15, ha='right') # تحسين التخطيط plt.tight_layout() return plt @staticmethod def create_company_match_radar(company_data: Dict): """Create radar chart for company match analysis using Matplotlib""" import matplotlib.patches as mpatches # البيانات categories = ['Industry Fit', 'Experience Match', 'Company Size', 'Hiring Status', 'Growth Potential', 'Salary Level'] score_breakdown = company_data.get('score_breakdown', {}) values = [ score_breakdown.get('industry_fit', 0), score_breakdown.get('experience_fit', 0), score_breakdown.get('company_size_fit', 0), score_breakdown.get('hiring_status', 0), score_breakdown.get('growth_potential', 0) * 10, min(company_data.get('salary_multiplier', 1) * 25, 100) ] # إغلاق الشكل values.append(values[0]) angles = np.linspace(0, 2*np.pi, len(categories), endpoint=False).tolist() angles.append(angles[0]) categories_closed = categories + [categories[0]] # إنشاء الشكل fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True)) # رسم الرادار ax.plot(angles, values, 'o-', linewidth=3, markersize=8, color='#3498db', label=company_data['company_name']) ax.fill(angles, values, alpha=0.25, color='#3498db') # رسم خط المستوى المستهدف target_values = [80] * (len(categories) + 1) ax.plot(angles, target_values, '--', linewidth=1, color='#2ecc71', label='Target Score (80)') # تخصيص الرسم ax.set_xticks(angles[:-1]) ax.set_xticklabels(categories, fontsize=11, fontweight='bold') ax.set_ylim(0, 100) ax.set_yticks([0, 25, 50, 75, 100]) ax.set_yticklabels(['0', '25', '50', '75', '100'], fontsize=10) ax.grid(True, alpha=0.3) # العنوان plt.title(f"Company Analysis: {company_data['company_name']}", fontsize=14, fontweight='bold', pad=20) plt.legend(loc='upper right', bbox_to_anchor=(1.3, 1.0)) # تحسين التخطيط plt.tight_layout() return plt @staticmethod def create_skill_gap_chart(required_skills: List[str], user_skills: List[str]): """Create skill gap analysis chart using Matplotlib""" plt.figure(figsize=(12, 6)) # تحضير البيانات skill_status = [] colors = [] for skill in required_skills[:10]: # Top 10 required skills if skill in user_skills: skill_status.append(100) colors.append('#2ecc71') # Green for acquired else: skill_status.append(30) # Low for missing colors.append('#e74c3c') # Red for missing # إنشاء الأعمدة bars = plt.bar(range(len(required_skills[:10])), skill_status, color=colors, alpha=0.8, edgecolor='black', linewidth=1) # إضافة النصوص for i, (bar, skill, status) in enumerate(zip(bars, required_skills[:10], skill_status)): plt.text(bar.get_x() + bar.get_width()/2., bar.get_height() + 1, f'{status}%', ha='center', va='bottom', fontsize=9, fontweight='bold') # تدوير أسماء المهارات plt.text(bar.get_x() + bar.get_width()/2., -5, skill[:15] + ('...' if len(skill) > 15 else ''), ha='center', va='top', rotation=45, fontsize=9) # تخصيص الرسم plt.title('Skill Gap Analysis', fontsize=16, fontweight='bold', pad=20) plt.ylabel('Status (%)', fontsize=12) plt.ylim(0, 110) plt.grid(axis='y', alpha=0.3, linestyle='--') # إزالة تسميات المحور X plt.xticks([]) # إضافة وسيلة إيضاح from matplotlib.patches import Patch legend_elements = [ Patch(facecolor='#2ecc71', edgecolor='black', label='Acquired Skill'), Patch(facecolor='#e74c3c', edgecolor='black', label='Missing Skill') ] plt.legend(handles=legend_elements, loc='upper right') # تحسين التخطيط plt.tight_layout() return plt # ==================== # GRADIO UI COMPONENTS # ==================== class UIComponents: @staticmethod def create_input_section() -> gr.Blocks: """Create comprehensive input section""" with gr.Blocks() as input_section: gr.Markdown("## 🎯 Personal & Professional Profile") with gr.Row(): with gr.Column(scale=1): country = gr.Dropdown( choices=sorted(Config.COUNTRIES.keys()), label="🌍 Select Your Country", value="Egypt", interactive=True, filterable=True, info="Select your current or target country" ) with gr.Column(scale=1): # Flatten majors list all_majors = [] for majors in Config.CAREER_CATEGORIES.values(): all_majors.extend(majors) major = gr.Dropdown( choices=sorted(all_majors), label="🎓 Select Your Major/Field", value="Computer Science", interactive=True, filterable=True, info="Select your academic or professional field" ) with gr.Row(): with gr.Column(scale=1): gpa = gr.Slider( minimum=2.0, maximum=4.0, value=3.5, step=0.1, label="📊 GPA (4.0 Scale)", info="Your cumulative GPA out of 4.0" ) with gr.Column(scale=1): experience_years = gr.Slider( minimum=0, maximum=40, value=3, step=1, label="📈 Years of Professional Experience", info="Total years of relevant work experience" ) with gr.Row(): with gr.Column(scale=1): experience_level = gr.Dropdown( choices=list(Config.EXPERIENCE_LEVELS.keys()), label="👨‍💼 Experience Level", value="Junior (3-5 years)", interactive=True, info="Your current professional level" ) with gr.Column(scale=1): has_linkedin = gr.Radio( choices=["Yes", "No"], label="🔗 Active LinkedIn Profile", value="Yes", info="Having an active LinkedIn profile increases visibility" ) with gr.Row(): with gr.Column(scale=1): num_courses = gr.Slider( minimum=0, maximum=50, value=5, step=1, label="📚 Professional Certifications", info="Number of online courses or professional certifications" ) with gr.Column(scale=1): skills = gr.Textbox( label="💼 Key Skills", placeholder="Python, Data Analysis, Project Management, Communication...", info="Enter your top skills (comma-separated)", lines=2 ) # Advanced options (collapsible) with gr.Accordion("⚙️ Advanced Options", open=False): with gr.Row(): with gr.Column(scale=1): university_tier = gr.Radio( choices=["Top Global", "National Top", "Regional", "Local", "Other"], label="🎓 University Tier", value="National Top", info="Reputation of your university" ) with gr.Column(scale=1): english_proficiency = gr.Radio( choices=["Native", "Fluent", "Professional", "Intermediate", "Basic"], label="🌐 English Proficiency", value="Fluent", info="Your English language level" ) with gr.Row(): with gr.Column(scale=1): arabic_proficiency = gr.Radio( choices=["Native", "Fluent", "Professional", "Intermediate", "Basic", "None"], label="📖 Arabic Proficiency", value="Native", info="Your Arabic language level" ) with gr.Column(scale=1): willing_to_relocate = gr.Checkbox( label="✈️ Willing to Relocate", value=True, info="Open to relocation opportunities" ) # Store all inputs inputs = { 'country': country, 'major': major, 'gpa': gpa, 'experience_years': experience_years, 'experience_level': experience_level, 'has_linkedin': has_linkedin, 'num_courses': num_courses, 'skills': skills, 'university_tier': university_tier, 'english_proficiency': english_proficiency, 'arabic_proficiency': arabic_proficiency, 'willing_to_relocate': willing_to_relocate } return input_section, inputs @staticmethod def create_results_section() -> Dict: """Create comprehensive results display section""" results = { 'salary_prediction': gr.Markdown("## 💰 Salary Prediction\n*Analysis in progress...*"), 'salary_analysis': gr.Markdown("### 📊 Salary Analysis\n*Detailed breakdown will appear here*"), 'top_companies': gr.Dataframe( headers=["Company", "Country", "Industry", "Match %", "Hiring", "Expected Salary"], label="🏢 Top Matching Companies", interactive=False, wrap=True, datatype=["str", "str", "str", "number", "str", "str"] ), 'company_details': gr.Markdown("### 🏛️ Company Details\n*Select a company for detailed analysis*"), 'career_recommendations': gr.Markdown("## 📈 Career Recommendations\n*Personalized advice will appear here*"), 'skill_development': gr.Markdown("### 🎯 Skill Development Plan\n*Target skills for career growth*"), 'salary_chart': gr.Plot(label="📊 Salary Comparison Analysis"), 'company_radar': gr.Plot(label="🎯 Company Match Radar"), 'skill_chart': gr.Plot(label="📈 Skill Gap Analysis") } return results # ==================== # MAIN APPLICATION # ==================== class CareerPredictionApp: def __init__(self): self.dm = DataManager() self.engine = PredictionEngine(self.dm) self.viz = VisualizationEngine() self.ui = UIComponents() def predict(self, country, major, gpa, experience_years, experience_level, has_linkedin, num_courses, skills, university_tier, english_proficiency, arabic_proficiency, willing_to_relocate) -> Tuple: """Main prediction function with detailed analysis""" try: # إنشاء قاموس من المدخلات inputs_dict = { 'country': country, 'major': major, 'gpa': gpa, 'experience_years': experience_years, 'experience_level': experience_level, 'has_linkedin': has_linkedin, 'num_courses': num_courses, 'skills': skills, 'university_tier': university_tier, 'english_proficiency': english_proficiency, 'arabic_proficiency': arabic_proficiency, 'willing_to_relocate': willing_to_relocate } # Predict salary with detailed analysis salary_prediction = self.engine.predict_salary(inputs_dict) # Find matching companies matching_companies = self.engine.find_matching_companies(inputs_dict, top_n=10) # Prepare company data for display company_display = [] for company in matching_companies: expected_salary = f"${company['expected_salary']:,}" company_display.append([ company['company_name'], company['country'], company['industry'], f"{company['match_score']:.0f}", company['hiring_status'], expected_salary ]) # Get top company for detailed analysis top_company = matching_companies[0] if matching_companies else None # Create visualizations benchmark_salaries = { 'Entry Level': self.engine.get_base_salary(inputs_dict['country'], inputs_dict['major']) * 0.7, 'Industry Average': self.engine.get_base_salary(inputs_dict['country'], inputs_dict['major']), 'Your Prediction': salary_prediction['predicted_salary'], 'Senior Level': self.engine.get_base_salary(inputs_dict['country'], inputs_dict['major']) * 1.5, 'Top 10%': self.engine.get_base_salary(inputs_dict['country'], inputs_dict['major']) * 1.8 } # إنشاء الرسم البياني للراتب salary_plot = self.viz.create_salary_comparison_chart( salary_prediction['predicted_salary'], benchmark_salaries, inputs_dict['country'], inputs_dict['major'] ) if top_company: company_radar = self.viz.create_company_match_radar(top_company) else: # Create dummy radar company_radar = self.viz.create_company_match_radar({ 'company_name': 'Market Average', 'score_breakdown': {'industry_fit': 50, 'experience_fit': 50, 'company_size_fit': 50, 'hiring_status': 50, 'growth_potential': 5}, 'salary_multiplier': 1.0 }) # Skill gap analysis user_skills = [s.strip().lower() for s in inputs_dict['skills'].split(',')] if inputs_dict['skills'] else [] career_category = None for category, majors in Config.CAREER_CATEGORIES.items(): if inputs_dict['major'] in majors: career_category = category break if career_category and career_category in self.dm.skills_data: required_skills = [] for skill_list in self.dm.skills_data[career_category].values(): required_skills.extend(skill_list[:5]) # Top skills from each category skill_chart = self.viz.create_skill_gap_chart(required_skills[:10], user_skills) else: skill_chart = None # Format detailed results salary_text = self.format_salary_prediction(salary_prediction, inputs_dict) salary_analysis = self.format_salary_analysis(salary_prediction) if top_company: company_details = self.format_company_details(top_company) else: company_details = "### 🏛️ Company Details\n*No matching companies found*" recommendations = self.generate_recommendations(salary_prediction, inputs_dict, matching_companies) skill_development = self.generate_skill_development(career_category, user_skills) outputs = [ salary_text, salary_analysis, company_display, company_details, recommendations, skill_development, salary_plot, company_radar ] if skill_chart: outputs.append(skill_chart) else: outputs.append(None) return tuple(outputs) except Exception as e: print(f"Prediction error: {e}") import traceback traceback.print_exc() error_msg = "## ⚠️ Error\nUnable to generate predictions. Please try again with different inputs." return (error_msg, error_msg, [], error_msg, error_msg, error_msg, None, None, None) def format_salary_prediction(self, prediction: Dict, inputs: Dict) -> str: """Format salary prediction results""" country_info = Config.COUNTRIES.get(inputs['country'], {}) return f""" ## 💰 Salary Prediction ### Predicted Annual Salary **${prediction['predicted_salary']:,} USD** *Range: {prediction['salary_range']}* ### 📊 Prediction Confidence **{prediction['confidence_score']:.0%}** - Based on profile completeness and market data ### 🎯 Profile Analysis - **Country**: {inputs['country']} ({country_info.get('gdp_tier', 'N/A')} GDP Tier) - **Major**: {inputs['major']} - **Experience**: {inputs['experience_years']} years ({prediction['exp_level']} Level) - **GPA**: {inputs['gpa']}/4.0 ({prediction['gpa_level']}) - **Certifications**: {prediction['courses_impact']} - **LinkedIn**: {prediction['linkedin_impact']} - **Skills**: {prediction['skills_impact']} *Note: Predictions are based on current market data and statistical models. Actual offers may vary.* """ def format_salary_analysis(self, prediction: Dict) -> str: """Format detailed salary analysis""" return f""" ### 📈 Detailed Analysis #### 🏆 Competitive Position - **GPA Impact**: {prediction['gpa_level']} academic performance - **Experience Level**: {prediction['exp_level']} professional standing - **Certification Value**: {prediction['courses_impact']} #### 🌍 Market Factors - **Country Economic Tier**: {prediction['country_tier']} - **Tech Infrastructure**: {prediction['tech_level']} - **Professional Visibility**: {prediction['linkedin_impact']} #### 💡 Improvement Opportunities Based on your current profile, you could potentially increase your salary by: - **15-25%** with 2-3 more years of targeted experience - **10-15%** with additional specialized certifications - **5-10%** by expanding your professional network """ def format_company_details(self, company: Dict) -> str: """Format company details""" score_breakdown = company.get('score_breakdown', {}) return f""" ### 🏛️ {company['company_name']} #### 📍 Company Information - **Country**: {company['country']} - **Industry**: {company['industry']} - **Company Size**: {company['company_size']} - **Hiring Status**: {company['hiring_status']} #### 🎯 Match Analysis **Overall Match Score**: {company['match_score']:.0f}/100 **Score Breakdown**: - Industry Fit: {score_breakdown.get('industry_fit', 0)}/30 - Experience Match: {score_breakdown.get('experience_fit', 0)}/25 - Company Size Fit: {score_breakdown.get('company_size_fit', 0)}/15 - Hiring Status: {score_breakdown.get('hiring_status', 0)}/20 - Growth Potential: {score_breakdown.get('growth_potential', 0)}/10 #### 💰 Expected Compensation **Estimated Salary**: ${company['expected_salary']:,} **Salary Multiplier**: {company['salary_multiplier']:.1f}x market average **Career Growth Score**: {company['career_growth_score']}/100 #### 📈 Recommendation This company is {'an excellent match' if company['match_score'] >= 80 else 'a good match' if company['match_score'] >= 65 else 'a potential match'} for your profile. """ def generate_recommendations(self, prediction: Dict, inputs: Dict, companies: List[Dict]) -> str: """Generate personalized career recommendations""" country = inputs['country'] major = inputs['major'] experience_years = float(inputs['experience_years']) recommendations = [] # Based on salary prediction if prediction['predicted_salary'] < 30000: recommendations.append("**💰 Salary Growth Strategy**: Focus on gaining specialized skills and certifications to move into higher-paying roles.") elif prediction['predicted_salary'] < 60000: recommendations.append("**📈 Mid-Career Development**: Consider leadership training and strategic networking to advance to senior positions.") else: recommendations.append("**🏆 Executive Advancement**: Focus on strategic impact, thought leadership, and building high-value networks.") # Based on experience if experience_years < 3: recommendations.append("**🎯 Early Career Focus**: Build a strong foundation through diverse projects and mentorship opportunities.") elif experience_years < 8: recommendations.append("**🚀 Mid-Career Acceleration**: Develop specialization and take on leadership responsibilities.") else: recommendations.append("**💼 Senior Leadership**: Focus on strategic initiatives, mentoring others, and industry influence.") # Based on country country_info = Config.COUNTRIES.get(country, {}) if country_info.get('tech_level') == 'Advanced': recommendations.append("**🌍 Global Opportunities**: Leverage advanced tech ecosystem for international career opportunities.") elif country_info.get('tech_level') == 'Developing': recommendations.append("**📱 Local Market Leadership**: Position yourself as an expert in the growing local tech scene.") # Based on matching companies if companies: top_industries = [c['industry'] for c in companies[:3]] recommendations.append(f"**🏢 Industry Focus**: High demand in {', '.join(set(top_industries))} sectors.") recommendations_text = "## 📈 Career Recommendations\n\n" + "\n\n".join(recommendations) # Add action plan action_plan = f""" ### 🗓️ 6-Month Action Plan 1. **Month 1-2**: Update professional profiles and portfolio 2. **Month 3-4**: Complete 1-2 key certifications 3. **Month 5-6**: Network with professionals in target companies ### 🤝 Networking Strategy - Connect with alumni from your university working in {major} - Join professional associations in {country} - Attend industry conferences (virtual or in-person) - Engage with thought leaders on LinkedIn ### 📚 Recommended Resources - Industry reports on {major} trends in {country} - Online courses from platforms like Coursera, edX, LinkedIn Learning - Professional certifications relevant to your field """ return recommendations_text + action_plan def generate_skill_development(self, career_category: str, user_skills: List[str]) -> str: """Generate skill development plan""" if not career_category or career_category not in self.dm.skills_data: return "### 🎯 Skill Development\n*Unable to generate skill recommendations*" skills_data = self.dm.skills_data[career_category] # Identify skill gaps critical_skills = [] for category, skills in skills_data.items(): critical_skills.extend(skills[:3]) # Top 3 from each category # Filter out skills user already has user_skills_lower = [s.lower() for s in user_skills] skill_gaps = [skill for skill in critical_skills[:10] if skill.lower() not in user_skills_lower] if not skill_gaps: skill_gaps = ["Advanced specialization in your current skills", "Industry-specific certifications", "Leadership and management training"] skill_text = f""" ### 🎯 Skill Development Plan #### 📋 Critical Skills for {career_category} **Technical Skills:** {', '.join(skills_data.get('technical_skills', skills_data.get('programming_languages', []))[:5])} **Professional Skills:** {', '.join(skills_data.get('soft_skills', skills_data.get('management_skills', []))[:5])} #### 🎓 Priority Development Areas 1. **Immediate Focus (1-3 months):** {skill_gaps[0] if len(skill_gaps) > 0 else 'Specialized certification'} 2. **Medium-term Goals (3-6 months):** {skill_gaps[1] if len(skill_gaps) > 1 else 'Advanced technical training'} 3. **Long-term Development (6-12 months):** {skill_gaps[2] if len(skill_gaps) > 2 else 'Leadership development'} #### 🚀 Learning Resources - **Online Platforms**: Coursera, edX, Udacity, LinkedIn Learning - **Certifications**: Industry-recognized credentials - **Practical Projects**: Real-world applications - **Mentorship**: Guidance from experienced professionals """ return skill_text # ==================== # GRADIO APP # ==================== def create_app() -> gr.Blocks: """Create the Gradio application interface""" app_instance = CareerPredictionApp() with gr.Blocks( title="🌍 Global Career Prediction Assistant", theme=gr.themes.Soft( primary_hue="blue", secondary_hue="purple", neutral_hue="gray" ), css=""" .gradio-container { max-width: 1400px; margin: 0 auto; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } .input-section { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 25px; border-radius: 15px; margin-bottom: 25px; color: white; } .output-card { background: white; padding: 25px; border-radius: 15px; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); border: 1px solid #e0e0e0; } .highlight { background: linear-gradient(120deg, #a8edea 0%, #fed6e3 100%); padding: 20px; border-radius: 10px; margin: 15px 0; } .dataframe { font-size: 14px; } .plot-container { border-radius: 10px; padding: 15px; background: white; box-shadow: 0 2px 10px rgba(0,0,0,0.05); } """ ) as app: # Header gr.Markdown(""" # 🌍 Global Career Prediction Assistant ### Your AI-Powered Career Advisor for 200+ Countries **Predict salaries, find matching companies, and get personalized career recommendations** *Powered by comprehensive global market data and AI analysis* """) # Create input section input_section, inputs = app_instance.ui.create_input_section() # Create results section results = app_instance.ui.create_results_section() # Submit button submit_btn = gr.Button( "🚀 Get Comprehensive Career Analysis", variant="primary", size="lg", elem_classes=["submit-btn"] ) # Clear button clear_btn = gr.Button("🔄 Clear All", variant="secondary") # Connect submit button submit_btn.click( fn=app_instance.predict, inputs=[inputs[key] for key in inputs.keys()], outputs=[ results['salary_prediction'], results['salary_analysis'], results['top_companies'], results['company_details'], results['career_recommendations'], results['skill_development'], results['salary_chart'], results['company_radar'], results['skill_chart'] ] ) # Clear function def clear_all(): return [gr.update(value=None) for _ in range(9)] clear_btn.click( fn=clear_all, inputs=[], outputs=[ results['salary_prediction'], results['salary_analysis'], results['top_companies'], results['company_details'], results['career_recommendations'], results['skill_development'], results['salary_chart'], results['company_radar'], results['skill_chart'] ] ) # Examples section with gr.Accordion("📋 Example Profiles", open=False): gr.Markdown("### Try these example profiles:") examples = [ ["Egypt", "Computer Science", 3.8, 5, "Mid Level (5-8 years)", "Yes", 8, "Python, Machine Learning, Data Analysis, Cloud Computing", "National Top", "Fluent", "Native", True], ["Saudi Arabia", "Petroleum Engineering", 3.5, 12, "Senior (8-12 years)", "Yes", 15, "Reservoir Engineering, Project Management, Risk Analysis", "Regional", "Professional", "Native", True], ["UAE", "Business Administration", 3.2, 3, "Junior (3-5 years)", "Yes", 5, "Marketing, Sales, Communication, Excel", "Local", "Fluent", "Native", True], ["USA", "Data Science", 3.9, 7, "Senior (8-12 years)", "Yes", 12, "Python, SQL, Machine Learning, Statistics, Data Visualization", "Top Global", "Native", "Basic", True], ["Turkey", "Electrical Engineering", 3.6, 8, "Senior (8-12 years)", "Yes", 10, "Power Systems, MATLAB, AutoCAD, Project Management", "National Top", "Professional", "Fluent", True] ] example_btns = [] for i, example in enumerate(examples, 1): btn = gr.Button(f"Example {i}: {example[0]} - {example[1]}", size="sm") example_btns.append(btn) btn.click( fn=lambda vals: vals, inputs=[gr.State(example)], outputs=[inputs[key] for key in inputs.keys()] + [ results['salary_prediction'], results['salary_analysis'], results['top_companies'], results['company_details'], results['career_recommendations'], results['skill_development'], results['salary_chart'], results['company_radar'], results['skill_chart'] ] ) # Footer gr.Markdown(f""" --- ### 📊 About This Platform This AI-powered platform analyzes career data across **{len(Config.COUNTRIES)} countries** and **{sum(len(majors) for majors in Config.CAREER_CATEGORIES.values())} career paths** to provide: - **Accurate Salary Predictions** using GDP tiers, tech levels, and local market data - **Intelligent Company Matching** with detailed scoring algorithms - **Personalized Recommendations** based on your unique profile - **Skill Gap Analysis** to guide your professional development ### 🌐 Global Coverage - **Arab World**: 22 Arab countries with detailed economic profiles - **Europe**: 44 countries with advanced tech ecosystems - **Asia**: 48 countries including emerging tech hubs - **Americas**: 35 countries from North, Central, and South America - **Africa**: 54 countries with growing opportunities - **Oceania**: 14 countries including Australia and New Zealand ### 🔍 Data Sources - World Bank GDP data and economic indicators - Global tech hub classifications - Industry salary surveys and reports - Company databases and hiring trends - Professional certification frameworks ### ⚠️ Disclaimer *Predictions are based on statistical models and market data. Actual results may vary based on individual circumstances, interview performance, and market conditions. This tool is for informational purposes only.* --- *Last Updated: {datetime.now().strftime("%B %d, %Y")} | Version 2.0 | Covering 200+ Countries Worldwide* """) return app # ==================== # APPLICATION LAUNCH # ==================== def main(): """Launch the application""" app = create_app() # Launch with Hugging Face Spaces settings app.launch( server_name="0.0.0.0", server_port=7860, share=False, debug=True, show_error=True, auth=None, max_file_size="100MB" ) if __name__ == "__main__": main()