Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from datasets import load_dataset
|
3 |
+
from transformers import pipeline
|
4 |
+
import requests
|
5 |
+
|
6 |
+
# Load necessary datasets from Hugging Face
|
7 |
+
ds_natural_questions = load_dataset("google-research-datasets/natural_questions", "default")
|
8 |
+
ds_open_questions = load_dataset("launch/open_question_type")
|
9 |
+
ds_question_generator = load_dataset("iarfmoose/question_generator")
|
10 |
+
ds_jobs = load_dataset("lukebarousse/data_jobs")
|
11 |
+
ds_courses = load_dataset("azrai99/coursera-course-dataset")
|
12 |
+
universities_url = "https://www.4icu.org/top-universities-world/"
|
13 |
+
|
14 |
+
# Initialize the LLaMA model pipeline for text-to-text generation
|
15 |
+
qa_pipeline = pipeline("text2text-generation", model="llama-3.1-70b-versatile", tokenizer="llama-3.1-70b-versatile")
|
16 |
+
|
17 |
+
# Streamlit App Interface
|
18 |
+
st.title("Career Counseling Application")
|
19 |
+
st.subheader("Build Your Profile and Discover Tailored Career Recommendations")
|
20 |
+
|
21 |
+
# Sidebar for Profile Setup
|
22 |
+
st.sidebar.header("Profile Setup")
|
23 |
+
educational_background = st.sidebar.text_input("Educational Background (e.g., Degree, Major)")
|
24 |
+
interests = st.sidebar.text_input("Interests (e.g., AI, Data Science, Engineering)")
|
25 |
+
tech_skills = st.sidebar.text_area("Technical Skills (e.g., Python, SQL, Machine Learning)")
|
26 |
+
soft_skills = st.sidebar.text_area("Soft Skills (e.g., Communication, Teamwork)")
|
27 |
+
|
28 |
+
# Save profile data for session-based recommendations
|
29 |
+
profile_data = {
|
30 |
+
"educational_background": educational_background,
|
31 |
+
"interests": interests,
|
32 |
+
"tech_skills": tech_skills,
|
33 |
+
"soft_skills": soft_skills
|
34 |
+
}
|
35 |
+
|
36 |
+
if st.sidebar.button("Save Profile"):
|
37 |
+
st.session_state.profile_data = profile_data
|
38 |
+
st.sidebar.success("Profile saved successfully!")
|
39 |
+
|
40 |
+
# Intelligent Q&A Section
|
41 |
+
st.header("Intelligent Q&A")
|
42 |
+
question = st.text_input("Ask a career-related question:")
|
43 |
+
if question:
|
44 |
+
answer = qa_pipeline(question)[0]["generated_text"]
|
45 |
+
st.write("Answer:", answer)
|
46 |
+
|
47 |
+
# Career and Job Recommendations Section
|
48 |
+
st.header("Career and Job Recommendations")
|
49 |
+
if profile_data:
|
50 |
+
job_recommendations = []
|
51 |
+
for job in ds_jobs["train"]:
|
52 |
+
if any(skill.lower() in job["description"].lower() for skill in tech_skills.split(',')):
|
53 |
+
job_recommendations.append(job["title"])
|
54 |
+
|
55 |
+
if job_recommendations:
|
56 |
+
st.subheader("Job Recommendations")
|
57 |
+
st.write("Based on your profile, here are some potential job roles:")
|
58 |
+
for job in job_recommendations[:5]: # Limit to top 5 job recommendations
|
59 |
+
st.write("- ", job)
|
60 |
+
else:
|
61 |
+
st.write("No specific job recommendations found matching your profile.")
|
62 |
+
|
63 |
+
# Course Suggestions Section
|
64 |
+
st.header("Course Suggestions")
|
65 |
+
if profile_data:
|
66 |
+
course_recommendations = []
|
67 |
+
for course in ds_courses["train"]:
|
68 |
+
if any(interest.lower() in course["title"].lower() for interest in interests.split(',')):
|
69 |
+
course_recommendations.append(course["title"])
|
70 |
+
|
71 |
+
if course_recommendations:
|
72 |
+
st.subheader("Recommended Courses")
|
73 |
+
st.write("Here are some courses related to your interests:")
|
74 |
+
for course in course_recommendations[:5]: # Limit to top 5 course recommendations
|
75 |
+
st.write("- ", course)
|
76 |
+
else:
|
77 |
+
st.write("No specific courses found matching your interests.")
|
78 |
+
|
79 |
+
# University Recommendations Section
|
80 |
+
st.header("Top Universities")
|
81 |
+
st.write("For further education, you can explore the top universities worldwide:")
|
82 |
+
st.write(f"[View Top Universities Rankings]({universities_url})")
|
83 |
+
|
84 |
+
# Conclusion
|
85 |
+
st.write("Thank you for using the Career Counseling Application!")
|