MansoorSarookh commited on
Commit
f0f0878
·
verified ·
1 Parent(s): f58fd6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -6
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  from datasets import load_dataset
 
3
  from transformers import pipeline
4
 
5
  # Constants
@@ -10,9 +11,12 @@ universities_url = "https://www.4icu.org/top-universities-world/"
10
  def load_datasets():
11
  ds_jobs = load_dataset("lukebarousse/data_jobs")
12
  ds_courses = load_dataset("azrai99/coursera-course-dataset")
13
- return ds_jobs, ds_courses
 
 
 
14
 
15
- ds_jobs, ds_courses = load_datasets()
16
 
17
  # Initialize the pipeline with caching, using an accessible model like 'google/flan-t5-large'
18
  @st.cache_resource
@@ -42,6 +46,30 @@ if st.sidebar.button("Save Profile"):
42
  }
43
  st.sidebar.success("Profile saved successfully!")
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  # Intelligent Q&A Section
46
  st.header("Intelligent Q&A")
47
  question = st.text_input("Ask a career-related question:")
@@ -54,11 +82,18 @@ st.header("Career and Job Recommendations")
54
  if "profile_data" in st.session_state:
55
  job_recommendations = []
56
  for job in ds_jobs["train"]:
57
- # Use an empty string if 'job_skills' is None
58
  job_skills = job.get("job_skills", "") or ""
59
  if any(skill.lower() in job_skills.lower() for skill in st.session_state.profile_data["tech_skills"].split(",")):
60
  job_recommendations.append(job.get("job_title_short", "Unknown Job Title"))
61
 
 
 
 
 
 
 
 
 
62
  if job_recommendations:
63
  st.subheader("Job Recommendations")
64
  st.write("Based on your profile, here are some potential job roles:")
@@ -67,15 +102,22 @@ if "profile_data" in st.session_state:
67
  else:
68
  st.write("No specific job recommendations found matching your profile.")
69
 
70
-
71
  # Course Suggestions Section
72
  st.header("Course Suggestions")
73
  if "profile_data" in st.session_state:
74
  course_recommendations = [
75
- course.get("Title", "Unknown Course Title") for course in ds_courses["train"]
76
- if any(interest.lower() in course.get("Title", "").lower() for interest in st.session_state.profile_data["interests"].split(","))
77
  ]
78
 
 
 
 
 
 
 
 
 
79
  if course_recommendations:
80
  st.subheader("Recommended Courses")
81
  st.write("Here are some courses related to your interests:")
@@ -89,5 +131,10 @@ st.header("Top Universities")
89
  st.write("For further education, you can explore the top universities worldwide:")
90
  st.write(f"[View Top Universities Rankings]({universities_url})")
91
 
 
 
 
 
 
92
  # Conclusion
93
  st.write("Thank you for using the Career Counseling Application!")
 
1
  import streamlit as st
2
  from datasets import load_dataset
3
+ import pandas as pd
4
  from transformers import pipeline
5
 
6
  # Constants
 
11
  def load_datasets():
12
  ds_jobs = load_dataset("lukebarousse/data_jobs")
13
  ds_courses = load_dataset("azrai99/coursera-course-dataset")
14
+ ds_custom_courses = pd.read_csv("final_cleaned_merged_coursera_courses.csv")
15
+ ds_custom_jobs = pd.read_csv("merged_data_science_jobs.csv")
16
+ ds_custom_universities = pd.read_csv("merged_university_data_cleaned (1).csv")
17
+ return ds_jobs, ds_courses, ds_custom_courses, ds_custom_jobs, ds_custom_universities
18
 
19
+ ds_jobs, ds_courses, ds_custom_courses, ds_custom_jobs, ds_custom_universities = load_datasets()
20
 
21
  # Initialize the pipeline with caching, using an accessible model like 'google/flan-t5-large'
22
  @st.cache_resource
 
46
  }
47
  st.sidebar.success("Profile saved successfully!")
48
 
49
+ # Questions Section (Appears after profile submission)
50
+ if "profile_data" in st.session_state:
51
+ st.header("Answer the Following Questions:")
52
+ questions = [
53
+ "What do you see yourself achieving in the next five years?",
54
+ "Which skills would you like to develop further? (Examples: leadership, technical expertise, communication, etc.)",
55
+ "Do you prefer a structured routine or a more flexible, varied work environment?",
56
+ "What’s most important to you in a job? (e.g., work-life balance, job stability, opportunities for growth, impact on society)",
57
+ "What types of projects or tasks energize you? (e.g., solving complex problems, helping others, creating something new)",
58
+ "Are you comfortable with roles that may involve public speaking or presenting ideas?",
59
+ "How do you handle stress or pressure in a work setting? (Select options: I thrive under pressure, I manage well, I prefer lower-stress environments)",
60
+ "Would you be open to relocation or travel for your job?",
61
+ "Do you prioritize high salary potential or job satisfaction when considering a career?",
62
+ "What kind of work culture are you drawn to? (e.g., collaborative, competitive, mission-driven, innovative)"
63
+ ]
64
+
65
+ answers = {}
66
+ for question in questions:
67
+ answers[question] = st.text_input(question)
68
+
69
+ if st.button("Submit Answers"):
70
+ st.session_state.answers = answers
71
+ st.success("Your answers have been saved!")
72
+
73
  # Intelligent Q&A Section
74
  st.header("Intelligent Q&A")
75
  question = st.text_input("Ask a career-related question:")
 
82
  if "profile_data" in st.session_state:
83
  job_recommendations = []
84
  for job in ds_jobs["train"]:
 
85
  job_skills = job.get("job_skills", "") or ""
86
  if any(skill.lower() in job_skills.lower() for skill in st.session_state.profile_data["tech_skills"].split(",")):
87
  job_recommendations.append(job.get("job_title_short", "Unknown Job Title"))
88
 
89
+ for _, job in ds_custom_jobs.iterrows():
90
+ job_skills = job.get("skills", "") or ""
91
+ if any(skill.lower() in job_skills.lower() for skill in st.session_state.profile_data["tech_skills"].split(",")):
92
+ job_recommendations.append(job.get("job_title", "Unknown Job Title"))
93
+
94
+ # Remove duplicates by converting the list to a set and back to a list
95
+ job_recommendations = list(set(job_recommendations))
96
+
97
  if job_recommendations:
98
  st.subheader("Job Recommendations")
99
  st.write("Based on your profile, here are some potential job roles:")
 
102
  else:
103
  st.write("No specific job recommendations found matching your profile.")
104
 
 
105
  # Course Suggestions Section
106
  st.header("Course Suggestions")
107
  if "profile_data" in st.session_state:
108
  course_recommendations = [
109
+ course.get("Course Name", "Unknown Course Title") for course in ds_courses["train"]
110
+ if any(interest.lower() in course.get("Course Name", "").lower() for interest in st.session_state.profile_data["interests"].split(","))
111
  ]
112
 
113
+ course_recommendations.extend([
114
+ row["Course Name"] for _, row in ds_custom_courses.iterrows()
115
+ if any(interest.lower() in row["Course Name"].lower() for interest in st.session_state.profile_data["interests"].split(","))
116
+ ])
117
+
118
+ # Remove duplicates from course recommendations
119
+ course_recommendations = list(set(course_recommendations))
120
+
121
  if course_recommendations:
122
  st.subheader("Recommended Courses")
123
  st.write("Here are some courses related to your interests:")
 
131
  st.write("For further education, you can explore the top universities worldwide:")
132
  st.write(f"[View Top Universities Rankings]({universities_url})")
133
 
134
+ st.subheader("Custom University Data")
135
+ if not ds_custom_universities.empty:
136
+ st.write("Here are some recommended universities based on custom data:")
137
+ st.dataframe(ds_custom_universities.head())
138
+
139
  # Conclusion
140
  st.write("Thank you for using the Career Counseling Application!")