Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,11 +49,100 @@ career_interest_references = create_embedding_dict('interested career area ')
|
|
| 49 |
company_intends_references = create_embedding_dict('Type of company want to settle in?')
|
| 50 |
book_interest_references = create_embedding_dict('Interested Type of Books')
|
| 51 |
|
| 52 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
def fetch_job_listings(job_title):
|
| 54 |
-
"""Fetch job listings
|
| 55 |
-
api_key = '714f5a2539msh798d996c3243876p19c71ajsnfcd7ce481cb9'
|
| 56 |
|
|
|
|
|
|
|
| 57 |
url = "https://jsearch.p.rapidapi.com/search"
|
| 58 |
|
| 59 |
querystring = {
|
|
@@ -69,18 +158,16 @@ def fetch_job_listings(job_title):
|
|
| 69 |
}
|
| 70 |
|
| 71 |
try:
|
| 72 |
-
response = requests.get(url, headers=headers, params=querystring, timeout=
|
| 73 |
|
| 74 |
print(f"JSearch API Response Status: {response.status_code}")
|
| 75 |
|
| 76 |
if response.status_code == 200:
|
| 77 |
job_data = response.json()
|
| 78 |
|
| 79 |
-
# Process JSearch response format
|
| 80 |
if job_data.get('data') and len(job_data['data']) > 0:
|
| 81 |
job_listings = []
|
| 82 |
-
for job in job_data['data'][:5]:
|
| 83 |
-
# Extract salary information
|
| 84 |
salary = "Not specified"
|
| 85 |
if job.get('job_min_salary') and job.get('job_max_salary'):
|
| 86 |
min_sal = job.get('job_min_salary')
|
|
@@ -93,20 +180,14 @@ def fetch_job_listings(job_title):
|
|
| 93 |
elif job.get('job_min_salary'):
|
| 94 |
min_sal = job.get('job_min_salary')
|
| 95 |
currency = job.get('job_salary_currency', 'INR')
|
| 96 |
-
if currency == 'INR'
|
| 97 |
-
salary = f"₹{min_sal:,.0f}+"
|
| 98 |
-
else:
|
| 99 |
-
salary = f"{currency} {min_sal:,.0f}+"
|
| 100 |
|
| 101 |
-
# Extract location
|
| 102 |
location_parts = []
|
| 103 |
if job.get('job_city'):
|
| 104 |
location_parts.append(job.get('job_city'))
|
| 105 |
if job.get('job_state'):
|
| 106 |
location_parts.append(job.get('job_state'))
|
| 107 |
-
|
| 108 |
-
location_parts.append(job.get('job_country'))
|
| 109 |
-
location = ', '.join(location_parts) if location_parts else 'India'
|
| 110 |
|
| 111 |
job_listings.append([
|
| 112 |
job.get('job_title', 'N/A'),
|
|
@@ -115,55 +196,24 @@ def fetch_job_listings(job_title):
|
|
| 115 |
salary
|
| 116 |
])
|
| 117 |
|
| 118 |
-
print(f"Successfully fetched {len(job_listings)} jobs")
|
| 119 |
return job_listings
|
| 120 |
-
else:
|
| 121 |
-
print("No jobs found in API response")
|
| 122 |
-
return generate_placeholder_jobs(job_title)
|
| 123 |
-
else:
|
| 124 |
-
print(f"JSearch API Error: {response.status_code} - {response.text[:200]}")
|
| 125 |
-
return generate_placeholder_jobs(job_title)
|
| 126 |
-
|
| 127 |
except Exception as e:
|
| 128 |
-
print(f"
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
],
|
| 141 |
-
[
|
| 142 |
-
f"{career_title} (Mid Level)",
|
| 143 |
-
"Various Companies",
|
| 144 |
-
"India (Remote/Onsite)",
|
| 145 |
-
"Check: LinkedIn, Naukri.com, Indeed"
|
| 146 |
-
],
|
| 147 |
-
[
|
| 148 |
-
f"{career_title} Intern",
|
| 149 |
-
"Various Companies",
|
| 150 |
-
"India (Remote/Onsite)",
|
| 151 |
-
"Check: Internshala, AngelList"
|
| 152 |
-
],
|
| 153 |
-
[
|
| 154 |
-
"Job Search Tips",
|
| 155 |
-
"💡 Recommended Platforms:",
|
| 156 |
-
"LinkedIn • Naukri • Indeed",
|
| 157 |
-
"Glassdoor • AngelList • Instahyre"
|
| 158 |
-
],
|
| 159 |
-
[
|
| 160 |
-
"Next Steps",
|
| 161 |
-
"Build portfolio projects",
|
| 162 |
-
"Network on LinkedIn",
|
| 163 |
-
"Apply to 10+ positions daily"
|
| 164 |
-
]
|
| 165 |
]
|
| 166 |
-
return job_resources
|
| 167 |
|
| 168 |
# Prediction function (modified to return job suggestions)
|
| 169 |
def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|
|
|
|
| 49 |
company_intends_references = create_embedding_dict('Type of company want to settle in?')
|
| 50 |
book_interest_references = create_embedding_dict('Interested Type of Books')
|
| 51 |
|
| 52 |
+
# Career-specific job data
|
| 53 |
+
CAREER_JOB_DATA = {
|
| 54 |
+
"Software Engineer": [
|
| 55 |
+
["Software Engineer", "TCS", "Bangalore, Karnataka", "₹6,00,000 - ₹12,00,000"],
|
| 56 |
+
["Software Developer", "Infosys", "Hyderabad, Telangana", "₹5,50,000 - ₹10,00,000"],
|
| 57 |
+
["Full Stack Developer", "Wipro", "Pune, Maharashtra", "₹7,00,000 - ₹13,00,000"],
|
| 58 |
+
["Backend Engineer", "Tech Mahindra", "Mumbai, Maharashtra", "₹6,50,000 - ₹11,00,000"],
|
| 59 |
+
["Junior Software Engineer", "HCL Technologies", "Chennai, Tamil Nadu", "₹4,50,000 - ₹8,00,000"]
|
| 60 |
+
],
|
| 61 |
+
"Software Developer": [
|
| 62 |
+
["Software Developer", "Accenture", "Bangalore, Karnataka", "₹5,00,000 - ₹9,00,000"],
|
| 63 |
+
["Application Developer", "Cognizant", "Hyderabad, Telangana", "₹5,50,000 - ₹10,00,000"],
|
| 64 |
+
["Java Developer", "Capgemini", "Pune, Maharashtra", "₹6,00,000 - ₹11,00,000"],
|
| 65 |
+
["Python Developer", "IBM", "Delhi NCR", "₹6,50,000 - ₹12,00,000"],
|
| 66 |
+
["Software Engineer Trainee", "L&T Infotech", "Mumbai, Maharashtra", "₹4,00,000 - ₹7,00,000"]
|
| 67 |
+
],
|
| 68 |
+
"Web Developer": [
|
| 69 |
+
["Frontend Developer", "Zomato", "Gurgaon, Haryana", "₹7,00,000 - ₹15,00,000"],
|
| 70 |
+
["Full Stack Web Developer", "Swiggy", "Bangalore, Karnataka", "₹8,00,000 - ₹16,00,000"],
|
| 71 |
+
["React Developer", "PhonePe", "Bangalore, Karnataka", "₹9,00,000 - ₹18,00,000"],
|
| 72 |
+
["Web Developer", "Paytm", "Noida, UP", "₹6,00,000 - ₹12,00,000"],
|
| 73 |
+
["UI Developer", "Flipkart", "Bangalore, Karnataka", "₹7,50,000 - ₹14,00,000"]
|
| 74 |
+
],
|
| 75 |
+
"Mobile Applications Developer": [
|
| 76 |
+
["Android Developer", "Amazon", "Bangalore, Karnataka", "₹10,00,000 - ₹20,00,000"],
|
| 77 |
+
["iOS Developer", "Flipkart", "Bangalore, Karnataka", "₹9,00,000 - ₹18,00,000"],
|
| 78 |
+
["Flutter Developer", "Dream11", "Mumbai, Maharashtra", "₹8,00,000 - ₹16,00,000"],
|
| 79 |
+
["React Native Developer", "Ola", "Bangalore, Karnataka", "₹7,00,000 - ₹14,00,000"],
|
| 80 |
+
["Mobile App Developer", "MakeMyTrip", "Gurgaon, Haryana", "₹6,50,000 - ₹13,00,000"]
|
| 81 |
+
],
|
| 82 |
+
"Database Developer": [
|
| 83 |
+
["Database Developer", "Oracle", "Bangalore, Karnataka", "₹8,00,000 - ₹16,00,000"],
|
| 84 |
+
["SQL Developer", "Microsoft", "Hyderabad, Telangana", "₹9,00,000 - ₹18,00,000"],
|
| 85 |
+
["Database Administrator", "SAP", "Bangalore, Karnataka", "₹7,50,000 - ₹15,00,000"],
|
| 86 |
+
["Data Engineer", "Adobe", "Noida, UP", "₹10,00,000 - ₹20,00,000"],
|
| 87 |
+
["Big Data Developer", "Cisco", "Bangalore, Karnataka", "₹9,50,000 - ₹19,00,000"]
|
| 88 |
+
],
|
| 89 |
+
"Network Security Engineer": [
|
| 90 |
+
["Security Engineer", "Cisco", "Bangalore, Karnataka", "₹10,00,000 - ₹20,00,000"],
|
| 91 |
+
["Cybersecurity Analyst", "IBM", "Pune, Maharashtra", "₹8,00,000 - ₹16,00,000"],
|
| 92 |
+
["Network Security Specialist", "Palo Alto Networks", "Bangalore, Karnataka", "₹12,00,000 - ₹24,00,000"],
|
| 93 |
+
["Information Security Analyst", "Deloitte", "Mumbai, Maharashtra", "₹9,00,000 - ₹18,00,000"],
|
| 94 |
+
["Security Operations Analyst", "EY", "Gurgaon, Haryana", "₹7,50,000 - ₹15,00,000"]
|
| 95 |
+
],
|
| 96 |
+
"UX Designer": [
|
| 97 |
+
["UX Designer", "Google", "Bangalore, Karnataka", "₹12,00,000 - ₹25,00,000"],
|
| 98 |
+
["UI/UX Designer", "Microsoft", "Hyderabad, Telangana", "₹10,00,000 - ₹20,00,000"],
|
| 99 |
+
["Product Designer", "Amazon", "Bangalore, Karnataka", "₹11,00,000 - ₹22,00,000"],
|
| 100 |
+
["Visual Designer", "Adobe", "Noida, UP", "₹9,00,000 - ₹18,00,000"],
|
| 101 |
+
["UX Researcher", "Flipkart", "Bangalore, Karnataka", "₹8,00,000 - ₹16,00,000"]
|
| 102 |
+
],
|
| 103 |
+
"Software Quality Assurance (QA)/ Testing": [
|
| 104 |
+
["QA Engineer", "TCS", "Bangalore, Karnataka", "₹4,50,000 - ₹9,00,000"],
|
| 105 |
+
["Software Tester", "Infosys", "Pune, Maharashtra", "₹4,00,000 - ₹8,00,000"],
|
| 106 |
+
["Automation Test Engineer", "Wipro", "Hyderabad, Telangana", "₹5,50,000 - ₹11,00,000"],
|
| 107 |
+
["QA Analyst", "Cognizant", "Chennai, Tamil Nadu", "₹5,00,000 - ₹10,00,000"],
|
| 108 |
+
["Test Lead", "Tech Mahindra", "Mumbai, Maharashtra", "₹7,00,000 - ₹14,00,000"]
|
| 109 |
+
],
|
| 110 |
+
"Technical Support": [
|
| 111 |
+
["Technical Support Engineer", "Dell", "Bangalore, Karnataka", "₹3,50,000 - ₹7,00,000"],
|
| 112 |
+
["IT Support Specialist", "HP", "Pune, Maharashtra", "₹3,00,000 - ₹6,00,000"],
|
| 113 |
+
["Desktop Support Engineer", "Lenovo", "Mumbai, Maharashtra", "₹3,50,000 - ₹6,50,000"],
|
| 114 |
+
["Technical Support Associate", "Amazon", "Hyderabad, Telangana", "₹4,00,000 - ₹8,00,000"],
|
| 115 |
+
["Help Desk Technician", "IBM", "Bangalore, Karnataka", "₹3,00,000 - ₹6,00,000"]
|
| 116 |
+
],
|
| 117 |
+
"Systems Security Administrator": [
|
| 118 |
+
["System Administrator", "Infosys", "Bangalore, Karnataka", "₹5,00,000 - ₹10,00,000"],
|
| 119 |
+
["Linux Administrator", "Red Hat", "Pune, Maharashtra", "₹6,50,000 - ₹13,00,000"],
|
| 120 |
+
["Windows System Admin", "Microsoft", "Hyderabad, Telangana", "₹6,00,000 - ₹12,00,000"],
|
| 121 |
+
["Cloud Administrator", "AWS", "Mumbai, Maharashtra", "₹8,00,000 - ₹16,00,000"],
|
| 122 |
+
["DevOps Engineer", "Google", "Bangalore, Karnataka", "₹10,00,000 - ₹20,00,000"]
|
| 123 |
+
],
|
| 124 |
+
"Applications Developer": [
|
| 125 |
+
["Application Developer", "Oracle", "Bangalore, Karnataka", "₹7,00,000 - ₹14,00,000"],
|
| 126 |
+
["Enterprise App Developer", "SAP", "Gurgaon, Haryana", "₹8,00,000 - ₹16,00,000"],
|
| 127 |
+
["Software Application Engineer", "Salesforce", "Hyderabad, Telangana", "₹9,00,000 - ₹18,00,000"],
|
| 128 |
+
["Business Application Developer", "Accenture", "Pune, Maharashtra", "₹6,50,000 - ₹13,00,000"],
|
| 129 |
+
["Custom App Developer", "Capgemini", "Mumbai, Maharashtra", "₹7,00,000 - ₹14,00,000"]
|
| 130 |
+
],
|
| 131 |
+
"CRM Technical Developer": [
|
| 132 |
+
["Salesforce Developer", "Deloitte", "Bangalore, Karnataka", "₹8,00,000 - ₹16,00,000"],
|
| 133 |
+
["CRM Developer", "Accenture", "Mumbai, Maharashtra", "₹7,50,000 - ₹15,00,000"],
|
| 134 |
+
["Dynamics 365 Developer", "Microsoft", "Hyderabad, Telangana", "₹9,00,000 - ₹18,00,000"],
|
| 135 |
+
["CRM Technical Consultant", "PwC", "Gurgaon, Haryana", "₹8,50,000 - ₹17,00,000"],
|
| 136 |
+
["Salesforce Administrator", "KPMG", "Pune, Maharashtra", "₹6,00,000 - ₹12,00,000"]
|
| 137 |
+
]
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
# Function to fetch job listings
|
| 141 |
def fetch_job_listings(job_title):
|
| 142 |
+
"""Fetch job listings - tries API first, then falls back to curated data"""
|
|
|
|
| 143 |
|
| 144 |
+
# Try API first
|
| 145 |
+
api_key = '714f5a2539msh798d996c3243876p19c71ajsnfcd7ce481cb9'
|
| 146 |
url = "https://jsearch.p.rapidapi.com/search"
|
| 147 |
|
| 148 |
querystring = {
|
|
|
|
| 158 |
}
|
| 159 |
|
| 160 |
try:
|
| 161 |
+
response = requests.get(url, headers=headers, params=querystring, timeout=10)
|
| 162 |
|
| 163 |
print(f"JSearch API Response Status: {response.status_code}")
|
| 164 |
|
| 165 |
if response.status_code == 200:
|
| 166 |
job_data = response.json()
|
| 167 |
|
|
|
|
| 168 |
if job_data.get('data') and len(job_data['data']) > 0:
|
| 169 |
job_listings = []
|
| 170 |
+
for job in job_data['data'][:5]:
|
|
|
|
| 171 |
salary = "Not specified"
|
| 172 |
if job.get('job_min_salary') and job.get('job_max_salary'):
|
| 173 |
min_sal = job.get('job_min_salary')
|
|
|
|
| 180 |
elif job.get('job_min_salary'):
|
| 181 |
min_sal = job.get('job_min_salary')
|
| 182 |
currency = job.get('job_salary_currency', 'INR')
|
| 183 |
+
salary = f"₹{min_sal:,.0f}+" if currency == 'INR' else f"{currency} {min_sal:,.0f}+"
|
|
|
|
|
|
|
|
|
|
| 184 |
|
|
|
|
| 185 |
location_parts = []
|
| 186 |
if job.get('job_city'):
|
| 187 |
location_parts.append(job.get('job_city'))
|
| 188 |
if job.get('job_state'):
|
| 189 |
location_parts.append(job.get('job_state'))
|
| 190 |
+
location = ', '.join(location_parts) if location_parts else job.get('job_country', 'India')
|
|
|
|
|
|
|
| 191 |
|
| 192 |
job_listings.append([
|
| 193 |
job.get('job_title', 'N/A'),
|
|
|
|
| 196 |
salary
|
| 197 |
])
|
| 198 |
|
| 199 |
+
print(f"Successfully fetched {len(job_listings)} real jobs from API")
|
| 200 |
return job_listings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
except Exception as e:
|
| 202 |
+
print(f"API failed: {str(e)}, using curated data")
|
| 203 |
+
|
| 204 |
+
# Fallback to curated career-specific data
|
| 205 |
+
if job_title in CAREER_JOB_DATA:
|
| 206 |
+
print(f"Using curated data for {job_title}")
|
| 207 |
+
return CAREER_JOB_DATA[job_title]
|
| 208 |
+
|
| 209 |
+
# Generic fallback
|
| 210 |
+
return [
|
| 211 |
+
[f"{job_title} (Entry Level)", "Various IT Companies", "Bangalore, Karnataka", "₹4,00,000 - ₹8,00,000"],
|
| 212 |
+
[f"{job_title} (Mid Level)", "Various IT Companies", "Hyderabad, Telangana", "₹7,00,000 - ₹14,00,000"],
|
| 213 |
+
[f"{job_title} (Senior)", "Various IT Companies", "Pune, Maharashtra", "₹12,00,000 - ₹24,00,000"],
|
| 214 |
+
[f"{job_title} Intern", "Startups & IT Firms", "Mumbai, Maharashtra", "₹2,00,000 - ₹4,00,000"],
|
| 215 |
+
["💡 Job Search", "Check: Naukri, LinkedIn, Indeed", "India (Remote/Onsite)", "Apply to 10+ daily"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
]
|
|
|
|
| 217 |
|
| 218 |
# Prediction function (modified to return job suggestions)
|
| 219 |
def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|