ArchiMathur commited on
Commit
1ccbd5a
·
verified ·
1 Parent(s): 56528d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -293,19 +293,18 @@ def fetch_job_listings(job_title):
293
  if job_data.get('jobs'):
294
  job_listings = []
295
  for job in job_data['jobs'][:5]: # Limit to 5 job listings
296
- job_info = {
297
- "Job Title": job.get('title', 'N/A'),
298
- "Company": job.get('company', 'N/A'),
299
- "Location": job.get('location', 'N/A'),
300
- "Salary": job.get('salary', 'Not specified')
301
- }
302
- job_listings.append(job_info)
303
  return job_listings
304
  else:
305
- return [{"Message": "No job listings found for this career path."}]
306
 
307
  except requests.RequestException as e:
308
- return [{"Error": f"Could not fetch job listings: {str(e)}"}]
309
 
310
  # Prediction function (modified to return job suggestions)
311
  def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
@@ -423,7 +422,10 @@ worker_list = ["hard worker", "smart worker"]
423
  def create_output_component():
424
  return [
425
  gr.Label(label="Career Probabilities"),
426
- gr.Dataframe(label="Job Suggestions")
 
 
 
427
  ]
428
 
429
  demo = gr.Interface(
@@ -458,5 +460,4 @@ demo = gr.Interface(
458
 
459
  # Main execution
460
  if __name__ == "__main__":
461
- demo.launch(share=True)
462
-
 
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
  # Prediction function (modified to return job suggestions)
310
  def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
 
422
  def create_output_component():
423
  return [
424
  gr.Label(label="Career Probabilities"),
425
+ gr.Dataframe(
426
+ headers=["Job Title", "Company", "Location", "Salary"],
427
+ label="Job Suggestions"
428
+ )
429
  ]
430
 
431
  demo = gr.Interface(
 
460
 
461
  # Main execution
462
  if __name__ == "__main__":
463
+ demo.launch(share=True)