prabaerode commited on
Commit
c9d8014
·
verified ·
1 Parent(s): 1298b52
Files changed (1) hide show
  1. app.py +70 -63
app.py CHANGED
@@ -1,117 +1,124 @@
1
  import os
2
  import streamlit as st
3
- from features import (ats,
4
- analyzer,
5
- company_recommend,
6
- cover_letter,
7
- enhance,
8
- improve,
9
- interview,
10
- linkedin,
11
- newresume,
12
- recommend,
13
- review)
14
  from components import docLoader
15
  from dotenv import load_dotenv
16
  import google.generativeai as genai
17
  from langchain_google_genai import ChatGoogleGenerativeAI
 
18
 
19
  # Load environment variables
20
  load_dotenv()
21
 
22
- # Initialize CareerEnchanter
23
- class CareerEnchanter(object):
24
- def __init__(self, title="CareerEnchanter"):
25
  self.title = title
26
 
27
  @staticmethod
28
  def model():
29
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
 
 
 
30
  return ChatGoogleGenerativeAI(model="gemini-pro")
31
 
32
- # Initialize CareerEnchanter instance
33
- enchanter = CareerEnchanter()
34
 
35
  # Set Streamlit page configuration
36
- st.set_page_config(page_title=enchanter.title, page_icon='🤖', layout='wide')
37
 
38
  # Main title
39
- st.title("🚀 Career Enchanter 🚀")
40
 
41
- # Load document
42
  text = docLoader.load_doc()
43
  st.session_state['doc_text'] = text
44
 
45
- jd, doc = st.columns(2)
46
- with jd:
47
- # Job Description input
48
- jd = st.text_area("Job Description: ", key="input")
49
- if text:
50
- with doc:
51
- extracted= st.text_area("Extracted Data From Resume", value=st.session_state['doc_text'])
52
 
53
- role=st.text_input("Role you want to Apply for")
54
  st.session_state['role'] = role
55
 
56
  # Sidebar options
57
  with st.sidebar:
58
- st.title('🔮 Career Enchanter 🔮')
59
- st.subheader('Options: ')
60
- option = st.radio("Select an option: ", (
61
- "ATS Score",
62
- "Resume Review",
63
- "Resume Enhancements",
64
- "Resume Improvements",
65
- "Recommendation",
66
- "Keywords",
67
- "Generate Cover Letter",
68
- "Resume Generator",
69
- "Linkedin Profile Update",
70
- "Possible Interview Questions",
71
- "Company Recommendations"
72
- ))
73
 
74
  # Load model
75
- with st.spinner("Loading Model..."):
76
- llm = enchanter.model()
77
- if option == "ATS Score":
78
- calculation_method = st.radio("Choose how you want to calculate ATS Score: ", ("Using AI", "Manually (Cosine Similarity)"), horizontal=True)
79
 
80
- elif option == "Recommendation":
81
- recommendation_type = st.radio("Select the type of recommendation you want: ", ("Entire Resume", "Section Wise"), horizontal=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
- elif option == "Keywords":
84
- analyz_type = st.radio("Select the type of Keywords Fucntion you want: ", ("Analyse Keywords", "Keyword Synonyms"), horizontal=True)
85
  # Dictionary mapping options to functions
86
  option_functions = {
87
- "ATS Score": ats.run_ats,
88
- "Resume Review": review.run_review,
89
- "Resume Enhancements": enhance.run_enhance,
90
- "Resume Improvements": improve.run_improve,
91
- "Recommendation": recommend.run_recommend,
92
- "Keywords": analyzer.run_analyzer,
93
  "Generate Cover Letter": cover_letter.run_letter,
94
- "Resume Generator": newresume.run_newresume,
95
- "Linkedin Profile Update": linkedin.run_linkedin,
96
- "Possible Interview Questions": interview.run_interview,
97
  "Company Recommendations": company_recommend.run_company
98
  }
99
 
100
  # Handle the selected option
101
  if option in option_functions:
102
  func = option_functions[option]
103
- if option == "ATS Score":
104
  if calculation_method == "Manually (Cosine Similarity)":
105
  func(llm, st.session_state['doc_text'], jd, manual=True)
106
  else:
107
  func(llm, st.session_state['doc_text'], jd)
108
- elif option == "Recommendation":
109
  if recommendation_type == "Entire Resume":
110
  func(llm, st.session_state['doc_text'], jd, section=True)
111
  else:
112
  func(llm, st.session_state['doc_text'], jd)
113
- elif option == "Keywords":
114
- if analyz_type == "Analyse Keywords":
115
  func(llm, st.session_state['doc_text'], jd, analysis=True)
116
  else:
117
  func(llm, st.session_state['doc_text'], jd)
 
1
  import os
2
  import streamlit as st
3
+ from features import (
4
+ ats, analyzer, company_recommend, cover_letter, enhance, improve,
5
+ interview, linkedin, newresume, recommend, review
6
+ )
 
 
 
 
 
 
 
7
  from components import docLoader
8
  from dotenv import load_dotenv
9
  import google.generativeai as genai
10
  from langchain_google_genai import ChatGoogleGenerativeAI
11
+ import asyncio
12
 
13
  # Load environment variables
14
  load_dotenv()
15
 
16
+ class CareerNavigator:
17
+ def __init__(self, title="Career Navigator"):
 
18
  self.title = title
19
 
20
  @staticmethod
21
  def model():
22
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
23
+ if not asyncio.get_event_loop().is_running():
24
+ loop = asyncio.new_event_loop()
25
+ asyncio.set_event_loop(loop)
26
  return ChatGoogleGenerativeAI(model="gemini-pro")
27
 
28
+ # Initialize CareerNavigator instance
29
+ navigator = CareerNavigator()
30
 
31
  # Set Streamlit page configuration
32
+ st.set_page_config(page_title=navigator.title, page_icon='🧑‍💼', layout='wide')
33
 
34
  # Main title
35
+ st.title("Welcome to Career Navigator")
36
 
37
+ # Load and display document
38
  text = docLoader.load_doc()
39
  st.session_state['doc_text'] = text
40
 
41
+ jd_col, doc_col = st.columns(2)
42
+ with jd_col:
43
+ jd = st.text_area("Enter Job Description:", key="input")
44
+ if text:
45
+ with doc_col:
46
+ st.text_area("Extracted Data From Resume:", value=st.session_state['doc_text'], height=300)
 
47
 
48
+ role = st.text_input("Desired Role:", placeholder="e.g., Software Engineer")
49
  st.session_state['role'] = role
50
 
51
  # Sidebar options
52
  with st.sidebar:
53
+ st.title('Career Navigator Menu')
54
+ st.subheader('Choose an Option:')
55
+ option = st.radio(
56
+ "Navigate to:",
57
+ (
58
+ "Calculate ATS Score", "Review Resume", "Enhance Resume",
59
+ "Improve Resume", "Get Recommendations", "Analyze Keywords",
60
+ "Generate Cover Letter", "Generate Resume",
61
+ "Update LinkedIn Profile", "Prepare for Interview",
62
+ "Company Recommendations"
63
+ )
64
+ )
 
 
 
65
 
66
  # Load model
67
+ with st.spinner("Initializing Model..."):
68
+ llm = navigator.model()
 
 
69
 
70
+ # Option-specific configurations
71
+ if option == "Calculate ATS Score":
72
+ calculation_method = st.radio(
73
+ "Select ATS Score Calculation Method:",
74
+ ("Using AI", "Manually (Cosine Similarity)"),
75
+ horizontal=True
76
+ )
77
+
78
+ elif option == "Get Recommendations":
79
+ recommendation_type = st.radio(
80
+ "Select Recommendation Type:",
81
+ ("Entire Resume", "Section Wise"),
82
+ horizontal=True
83
+ )
84
+
85
+ elif option == "Analyze Keywords":
86
+ analyz_type = st.radio(
87
+ "Select Keywords Function:",
88
+ ("Analyze Keywords", "Keyword Synonyms"),
89
+ horizontal=True
90
+ )
91
 
 
 
92
  # Dictionary mapping options to functions
93
  option_functions = {
94
+ "Calculate ATS Score": ats.run_ats,
95
+ "Review Resume": review.run_review,
96
+ "Enhance Resume": enhance.run_enhance,
97
+ "Improve Resume": improve.run_improve,
98
+ "Get Recommendations": recommend.run_recommend,
99
+ "Analyze Keywords": analyzer.run_analyzer,
100
  "Generate Cover Letter": cover_letter.run_letter,
101
+ "Generate Resume": newresume.run_newresume,
102
+ "Update LinkedIn Profile": linkedin.run_linkedin,
103
+ "Prepare for Interview": interview.run_interview,
104
  "Company Recommendations": company_recommend.run_company
105
  }
106
 
107
  # Handle the selected option
108
  if option in option_functions:
109
  func = option_functions[option]
110
+ if option == "Calculate ATS Score":
111
  if calculation_method == "Manually (Cosine Similarity)":
112
  func(llm, st.session_state['doc_text'], jd, manual=True)
113
  else:
114
  func(llm, st.session_state['doc_text'], jd)
115
+ elif option == "Get Recommendations":
116
  if recommendation_type == "Entire Resume":
117
  func(llm, st.session_state['doc_text'], jd, section=True)
118
  else:
119
  func(llm, st.session_state['doc_text'], jd)
120
+ elif option == "Analyze Keywords":
121
+ if analyz_type == "Analyze Keywords":
122
  func(llm, st.session_state['doc_text'], jd, analysis=True)
123
  else:
124
  func(llm, st.session_state['doc_text'], jd)