tahirsher commited on
Commit
417ac0c
·
verified ·
1 Parent(s): 9c3a944

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +100 -0
app.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from datasets import load_dataset
3
+ from transformers import pipeline
4
+
5
+ # Load necessary datasets from Hugging Face
6
+ ds_natural_questions = load_dataset("google-research-datasets/natural_questions", "default")
7
+ ds_open_questions = load_dataset("launch/open_question_type")
8
+ ds_question_generator = load_dataset("iarfmoose/question_generator")
9
+ ds_jobs = load_dataset("lukebarousse/data_jobs")
10
+ ds_courses = load_dataset("azrai99/coursera-course-dataset")
11
+ universities_url = "https://www.4icu.org/top-universities-world/"
12
+
13
+ # Initialize the LLaMA model pipeline for text-to-text generation
14
+ qa_pipeline = pipeline("text2text-generation", model="allenai/t5-large-squad2")
15
+
16
+ # Streamlit App Interface
17
+ st.title("Career Counseling Application")
18
+ st.subheader("Build Your Profile and Discover Tailored Career Recommendations")
19
+
20
+ # Sidebar for Profile Setup
21
+ st.sidebar.header("Profile Setup")
22
+ educational_background = st.sidebar.text_input("Educational Background (e.g., Degree, Major)")
23
+ interests = st.sidebar.text_input("Interests (e.g., AI, Data Science, Engineering)")
24
+ tech_skills = st.sidebar.text_area("Technical Skills (e.g., Python, SQL, Machine Learning)")
25
+ soft_skills = st.sidebar.text_area("Soft Skills (e.g., Communication, Teamwork)")
26
+
27
+ # Save profile data for session-based recommendations
28
+ profile_data = {
29
+ "educational_background": educational_background,
30
+ "interests": interests,
31
+ "tech_skills": tech_skills,
32
+ "soft_skills": soft_skills
33
+ }
34
+
35
+ if st.sidebar.button("Save Profile"):
36
+ st.session_state.profile_data = profile_data
37
+ st.sidebar.success("Profile saved successfully!")
38
+
39
+ # Intelligent Q&A Session
40
+ st.header("Intelligent Q&A Session")
41
+ if "profile_data" in st.session_state:
42
+ st.write("Please answer the following questions based on your profile to help us suggest suitable careers for you.")
43
+
44
+ questions = []
45
+ # Generate or select 10 questions based on profile interests, skills, etc.
46
+ for i in range(10):
47
+ question_text = ds_natural_questions["train"][i]["question"] if i < len(ds_natural_questions["train"]) else None
48
+ if question_text:
49
+ question_text = question_text.replace("interests", interests).replace("skills", tech_skills)
50
+ questions.append(question_text)
51
+
52
+ # Display questions and collect answers
53
+ answers = []
54
+ for i, question in enumerate(questions):
55
+ answer = st.text_input(f"Q{i+1}: {question}")
56
+ answers.append(answer)
57
+
58
+ # Store answers in session state for further analysis
59
+ st.session_state.answers = answers
60
+
61
+ # Career and Job Recommendations Section
62
+ st.header("Career and Job Recommendations")
63
+ if "profile_data" in st.session_state:
64
+ job_recommendations = []
65
+ for job in ds_jobs["train"]:
66
+ job_skills = job.get("job_skills", "") or ""
67
+ if any(skill.lower() in job_skills.lower() for skill in st.session_state.profile_data["tech_skills"].split(",")):
68
+ job_recommendations.append((job.get("job_title_short", "Unknown Job Title"), job.get("job_url", "#")))
69
+
70
+ if job_recommendations:
71
+ st.subheader("Job Recommendations")
72
+ st.write("Based on your profile and responses, here are some potential job roles and links to explore:")
73
+ for job_title, job_url in job_recommendations[:5]: # Limit to top 5 job recommendations
74
+ st.write(f"- [{job_title}]({job_url})")
75
+ else:
76
+ st.write("No specific job recommendations found matching your profile.")
77
+
78
+ # Course Suggestions Section
79
+ st.header("Course Suggestions")
80
+ if "profile_data" in st.session_state:
81
+ course_recommendations = []
82
+ for course in ds_courses["train"]:
83
+ if any(interest.lower() in course.get("Title", "").lower() for interest in st.session_state.profile_data["interests"].split(",")):
84
+ course_recommendations.append((course.get("Title", "Unknown Course"), course.get("course_url", "#")))
85
+
86
+ if course_recommendations:
87
+ st.subheader("Recommended Courses")
88
+ st.write("Here are some courses related to your interests:")
89
+ for course_title, course_url in course_recommendations[:5]: # Limit to top 5 course recommendations
90
+ st.write(f"- [{course_title}]({course_url})")
91
+ else:
92
+ st.write("No specific courses found matching your interests.")
93
+
94
+ # University Recommendations Section
95
+ st.header("Top Universities")
96
+ st.write("For further education, you can explore the top universities worldwide:")
97
+ st.write(f"[View Top Universities Rankings]({universities_url})")
98
+
99
+ # Conclusion
100
+ st.write("Thank you for using the Career Counseling Application!")