Spaces:
Sleeping
Sleeping
import streamlit as st | |
import pandas as pd | |
import sqlite3 | |
from transformers import pipeline | |
# Database Setup | |
conn = sqlite3.connect("career_coach.db", check_same_thread=False) | |
c = conn.cursor() | |
c.execute('''CREATE TABLE IF NOT EXISTS users (name TEXT, skills TEXT, experience TEXT, education TEXT, goals TEXT)''') | |
conn.commit() | |
# Hugging Face Setup | |
interview_model = pipeline("text-generation", model="gpt2") # You can replace with a more suitable model | |
resume_model = pipeline("text-classification", model="distilbert-base-uncased") | |
# Career Profile Class | |
class CareerProfile: | |
def __init__(self, name, skills, experience, education, goals): | |
self.name = name | |
self.skills = skills | |
self.experience = experience | |
self.education = education | |
self.goals = goals | |
def save_to_db(self): | |
c.execute("INSERT INTO users VALUES (?, ?, ?, ?, ?)", | |
(self.name, self.skills, self.experience, self.education, self.goals)) | |
conn.commit() | |
# Job Recommender Class | |
class JobRecommender: | |
def __init__(self, user_skills): | |
self.user_skills = user_skills | |
self.jobs_df = pd.read_csv("jobs_data.csv") # Load job dataset | |
def recommend_jobs(self): | |
return self.jobs_df[self.jobs_df['Skills'].str.contains(self.user_skills, case=False, na=False)].head(5) | |
# Interview Coach Class | |
class InterviewCoach: | |
def __init__(self, question): | |
self.question = question | |
def get_feedback(self, response): | |
prompt = f"Evaluate the following response for a job interview question '{self.question}': {response}" | |
result = interview_model(prompt, max_length=200, num_return_sequences=1) | |
return result[0]['generated_text'] | |
# Resume Enhancer Class | |
class ResumeEnhancer: | |
def __init__(self, resume_text): | |
self.resume_text = resume_text | |
def analyze_resume(self): | |
prompt = f"Analyze this resume and suggest improvements for ATS compatibility: {self.resume_text}" | |
result = resume_model(prompt) | |
return result[0]['label'] # Assuming the model returns the label for the analysis | |
# Streamlit UI | |
st.sidebar.title("Virtual Career Coach") | |
page = st.sidebar.radio("Navigation", ["Home", "Job Recommendations", "Interview Coach", "Resume Enhancer", "Career Growth"]) | |
if page == "Home": | |
st.title("Career Profile Setup") | |
name = st.text_input("Name") | |
skills = st.text_area("Skills") | |
experience = st.text_area("Experience") | |
education = st.text_area("Education") | |
goals = st.text_area("Career Goals") | |
if st.button("Save Profile"): | |
profile = CareerProfile(name, skills, experience, education, goals) | |
profile.save_to_db() | |
st.success("Profile saved successfully!") | |
elif page == "Job Recommendations": | |
st.title("Job Recommendations") | |
user_skills = st.text_input("Enter your skills for job matching") | |
if st.button("Find Jobs"): | |
recommender = JobRecommender(user_skills) | |
jobs = recommender.recommend_jobs() | |
st.write(jobs) | |
elif page == "Interview Coach": | |
st.title("AI-Powered Interview Coach") | |
question = st.text_input("Enter a job interview question") | |
response = st.text_area("Your Response") | |
if st.button("Get Feedback"): | |
coach = InterviewCoach(question) | |
feedback = coach.get_feedback(response) | |
st.write(feedback) | |
elif page == "Resume Enhancer": | |
st.title("Resume & Cover Letter Enhancer") | |
resume_text = st.text_area("Paste your resume text") | |
if st.button("Analyze Resume"): | |
enhancer = ResumeEnhancer(resume_text) | |
feedback = enhancer.analyze_resume() | |
st.write(feedback) | |
elif page == "Career Growth": | |
st.title("Career Growth Suggestions") | |
st.write("Coming Soon: Personalized Learning Paths, Networking Strategies, and Industry Insights!") | |