Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -270,41 +270,76 @@ career_interest_references = create_embedding_dict('interested career area ')
|
|
| 270 |
company_intends_references = create_embedding_dict('Type of company want to settle in?')
|
| 271 |
book_interest_references = create_embedding_dict('Interested Type of Books')
|
| 272 |
|
| 273 |
-
# Function to fetch job listings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
def fetch_job_listings(job_title):
|
| 275 |
url = "https://jobs-api14.p.rapidapi.com/v2/list"
|
|
|
|
| 276 |
querystring = {
|
| 277 |
-
"query":
|
| 278 |
-
"location": "India"
|
| 279 |
-
"autoTranslateLocation": "false",
|
| 280 |
-
"remoteOnly": "false",
|
| 281 |
-
"employmentTypes": "fulltime;parttime;intern;contractor"
|
| 282 |
}
|
|
|
|
| 283 |
headers = {
|
| 284 |
-
"
|
| 285 |
-
"
|
| 286 |
}
|
| 287 |
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
except requests.RequestException as e:
|
| 307 |
-
return [['Error', 'fetching', 'job listings', str(e)]]
|
| 308 |
|
| 309 |
# Prediction function (modified to return job suggestions)
|
| 310 |
def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|
|
|
|
| 270 |
company_intends_references = create_embedding_dict('Type of company want to settle in?')
|
| 271 |
book_interest_references = create_embedding_dict('Interested Type of Books')
|
| 272 |
|
| 273 |
+
# # Function to fetch job listings
|
| 274 |
+
# def fetch_job_listings(job_title):
|
| 275 |
+
# url = "https://jobs-api14.p.rapidapi.com/v2/list"
|
| 276 |
+
# querystring = {
|
| 277 |
+
# "query": "software engineer",
|
| 278 |
+
# "location": "India",
|
| 279 |
+
# "autoTranslateLocation": "false",
|
| 280 |
+
# "remoteOnly": "false",
|
| 281 |
+
# "employmentTypes": "fulltime;parttime;intern;contractor"
|
| 282 |
+
# }
|
| 283 |
+
# headers = {
|
| 284 |
+
# "x-rapidapi-key": "47d14c1b58msh66e23d95e91b8bep110e5fjsn64ef19ff56c0",
|
| 285 |
+
# "x-rapidapi-host": "job-posting-feed-api.p.rapidapi.com"
|
| 286 |
+
# }
|
| 287 |
+
|
| 288 |
+
# try:
|
| 289 |
+
# response = requests.get(url, headers=headers, params=querystring)
|
| 290 |
+
# job_data = response.json()
|
| 291 |
+
|
| 292 |
+
# # Process and format job listings
|
| 293 |
+
# if job_data.get('jobs'):
|
| 294 |
+
# job_listings = []
|
| 295 |
+
# for job in job_data['jobs'][:5]: # Limit to 5 job listings
|
| 296 |
+
# job_listings.append([
|
| 297 |
+
# job.get('title', 'N/A'),
|
| 298 |
+
# job.get('company', 'N/A'),
|
| 299 |
+
# job.get('location', 'N/A'),
|
| 300 |
+
# job.get('salary', 'Not specified')
|
| 301 |
+
# ])
|
| 302 |
+
# return job_listings
|
| 303 |
+
# else:
|
| 304 |
+
# return [['No job listings', 'found', 'for this', 'career path']]
|
| 305 |
+
|
| 306 |
+
# except requests.RequestException as e:
|
| 307 |
+
# return [['Error', 'fetching', 'job listings', str(e)]]
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
import requests
|
| 312 |
+
|
| 313 |
def fetch_job_listings(job_title):
|
| 314 |
url = "https://jobs-api14.p.rapidapi.com/v2/list"
|
| 315 |
+
|
| 316 |
querystring = {
|
| 317 |
+
"query": job_title,
|
| 318 |
+
"location": "India"
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
+
|
| 321 |
headers = {
|
| 322 |
+
"X-RapidAPI-Key": "47d14c1b58msh66e23d95e91b8bep110e5fjsn64ef19ff56c0",
|
| 323 |
+
"X-RapidAPI-Host": "jobs-api14.p.rapidapi.com"
|
| 324 |
}
|
| 325 |
|
| 326 |
+
response = requests.get(url, headers=headers, params=querystring)
|
| 327 |
+
job_data = response.json()
|
| 328 |
+
|
| 329 |
+
print("RAW RESPONSE:", job_data) # DEBUG (keep this for now)
|
| 330 |
+
|
| 331 |
+
if job_data.get("jobs"):
|
| 332 |
+
job_listings = []
|
| 333 |
+
for job in job_data["jobs"][:5]:
|
| 334 |
+
job_listings.append([
|
| 335 |
+
job.get("title", "N/A"),
|
| 336 |
+
job.get("company", "N/A"),
|
| 337 |
+
job.get("location", "N/A"),
|
| 338 |
+
job.get("salary", "Not specified")
|
| 339 |
+
])
|
| 340 |
+
return job_listings
|
| 341 |
+
else:
|
| 342 |
+
return [["No job listings", "found", "for this", "career path"]]
|
|
|
|
|
|
|
|
|
|
| 343 |
|
| 344 |
# Prediction function (modified to return job suggestions)
|
| 345 |
def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|