import os import streamlit as st from features import ( ats, analyzer, company_recommend, cover_letter, enhance, improve, interview, linkedin, newresume, recommend, review ) from components import docLoader from dotenv import load_dotenv import google.generativeai as genai from langchain_google_genai import ChatGoogleGenerativeAI import asyncio # Load environment variables load_dotenv() class CareerNavigator: def __init__(self, title="Career Navigator"): self.title = title @staticmethod async def async_model(): genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) return ChatGoogleGenerativeAI(model="gemini-pro") def model(self): return asyncio.run(self.async_model()) # Initialize CareerNavigator instance navigator = CareerNavigator() # Set Streamlit page configuration st.set_page_config(page_title=navigator.title, page_icon='🧑‍💼', layout='wide') # Main title st.title("Welcome to Career Navigator") # Load and display document text = docLoader.load_doc() st.session_state['doc_text'] = text jd_col, doc_col = st.columns(2) with jd_col: jd = st.text_area("Enter Job Description:", key="input") if text: with doc_col: st.text_area("Extracted Data From Resume:", value=st.session_state['doc_text'], height=300) role = st.text_input("Desired Role:", placeholder="e.g., Software Engineer") st.session_state['role'] = role # Sidebar options with st.sidebar: st.title('Career Navigator Menu') st.subheader('Choose an Option:') option = st.radio( "Navigate to:", ( "Calculate ATS Score", "Review Resume", "Enhance Resume", "Improve Resume", "Get Recommendations", "Analyze Keywords", "Generate Cover Letter", "Generate Resume", "Update LinkedIn Profile", "Prepare for Interview", "Company Recommendations" ) ) # Load model with st.spinner("Initializing Model..."): llm = navigator.model() # Option-specific configurations if option == "Calculate ATS Score": calculation_method = st.radio( "Select ATS Score Calculation Method:", ("Using AI", "Manually (Cosine Similarity)"), horizontal=True ) elif option == "Get Recommendations": recommendation_type = st.radio( "Select Recommendation Type:", ("Entire Resume", "Section Wise"), horizontal=True ) elif option == "Analyze Keywords": analyz_type = st.radio( "Select Keywords Function:", ("Analyze Keywords", "Keyword Synonyms"), horizontal=True ) # Dictionary mapping options to functions option_functions = { "Calculate ATS Score": ats.run_ats, "Review Resume": review.run_review, "Enhance Resume": enhance.run_enhance, "Improve Resume": improve.run_improve, "Get Recommendations": recommend.run_recommend, "Analyze Keywords": analyzer.run_analyzer, "Generate Cover Letter": cover_letter.run_letter, "Generate Resume": newresume.run_newresume, "Update LinkedIn Profile": linkedin.run_linkedin, "Prepare for Interview": interview.run_interview, "Company Recommendations": company_recommend.run_company } # Handle the selected option if option in option_functions: func = option_functions[option] if option == "Calculate ATS Score": if calculation_method == "Manually (Cosine Similarity)": func(llm, st.session_state['doc_text'], jd, manual=True) else: func(llm, st.session_state['doc_text'], jd) elif option == "Get Recommendations": if recommendation_type == "Entire Resume": func(llm, st.session_state['doc_text'], jd, section=True) else: func(llm, st.session_state['doc_text'], jd) elif option == "Analyze Keywords": if analyz_type == "Analyze Keywords": func(llm, st.session_state['doc_text'], jd, analysis=True) else: func(llm, st.session_state['doc_text'], jd) else: func(llm, st.session_state['doc_text'], jd, role=st.session_state['role'])