Spaces:
Runtime error
Runtime error
Done
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
-
|
2 |
-
|
3 |
import time
|
4 |
import numpy as np
|
5 |
-
import pandas as pd
|
6 |
import streamlit as st
|
7 |
from streamlit_option_menu import option_menu
|
8 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
@@ -48,6 +46,24 @@ def streamlit_config():
|
|
48 |
st.markdown(page_background_color, unsafe_allow_html=True)
|
49 |
st.markdown(f'<h1 style="text-align: center;">Talent Track By AI</h1>', unsafe_allow_html=True)
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
class resume_analyzer:
|
52 |
def pdf_to_chunks(pdf):
|
53 |
pdf_reader = PdfReader(pdf)
|
@@ -86,26 +102,26 @@ class resume_analyzer:
|
|
86 |
def resume_summary():
|
87 |
with st.form(key='Summary'):
|
88 |
add_vertical_space(1)
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
add_vertical_space(3)
|
95 |
if submit:
|
96 |
-
if
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
st.write(summary)
|
105 |
-
except Exception as e:
|
106 |
-
st.markdown(f'<h5 style="text-align: center;color: orange;">{e}</h5>', unsafe_allow_html=True)
|
107 |
-
elif pdf is None:
|
108 |
-
st.markdown(f'<h5 style="text-align: center;color: orange;">Please Upload Your Resume</h5>', unsafe_allow_html=True)
|
109 |
|
110 |
def strength_prompt(query_with_chunks):
|
111 |
query = f'''need to detailed analysis and explain of the strength of below resume and finally conclude them
|
@@ -118,29 +134,32 @@ class resume_analyzer:
|
|
118 |
def resume_strength():
|
119 |
with st.form(key='Strength'):
|
120 |
add_vertical_space(1)
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
add_vertical_space(3)
|
127 |
if submit:
|
128 |
-
if
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
st.
|
142 |
-
elif pdf is None:
|
143 |
-
st.markdown(f'<h5 style="text-align: center;color: orange;">Please Upload Your Resume</h5>', unsafe_allow_html=True)
|
144 |
|
145 |
def weakness_prompt(query_with_chunks):
|
146 |
query = f'''need to detailed analysis and explain of the weakness of below resume and how to improve make a better resume.
|
@@ -152,29 +171,32 @@ class resume_analyzer:
|
|
152 |
def resume_weakness():
|
153 |
with st.form(key='Weakness'):
|
154 |
add_vertical_space(1)
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
add_vertical_space(3)
|
161 |
if submit:
|
162 |
-
if
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
st.
|
176 |
-
elif pdf is None:
|
177 |
-
st.markdown(f'<h5 style="text-align: center;color: orange;">Please Upload Your Resume</h5>', unsafe_allow_html=True)
|
178 |
|
179 |
def job_title_prompt(query_with_chunks):
|
180 |
query = f''' what are the job roles i apply to likedin based on below?
|
@@ -187,29 +209,32 @@ class resume_analyzer:
|
|
187 |
def job_title_suggestion():
|
188 |
with st.form(key='Job Titles'):
|
189 |
add_vertical_space(1)
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
add_vertical_space(3)
|
196 |
if submit:
|
197 |
-
if
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
st.
|
211 |
-
elif pdf is None:
|
212 |
-
st.markdown(f'<h5 style="text-align: center;color: orange;">Please Upload Your Resume</h5>', unsafe_allow_html=True)
|
213 |
|
214 |
class linkedin_scraper:
|
215 |
def webdriver_setup():
|
|
|
|
|
|
|
1 |
import time
|
2 |
import numpy as np
|
3 |
+
import pandas as pd
|
4 |
import streamlit as st
|
5 |
from streamlit_option_menu import option_menu
|
6 |
from streamlit_extras.add_vertical_space import add_vertical_space
|
|
|
46 |
st.markdown(page_background_color, unsafe_allow_html=True)
|
47 |
st.markdown(f'<h1 style="text-align: center;">Talent Track By AI</h1>', unsafe_allow_html=True)
|
48 |
|
49 |
+
def process_resume(pdf):
|
50 |
+
if pdf is not None:
|
51 |
+
try:
|
52 |
+
with st.spinner('Processing...'):
|
53 |
+
pdf_chunks = resume_analyzer.pdf_to_chunks(pdf)
|
54 |
+
summary_prompt = resume_analyzer.summary_prompt(query_with_chunks=pdf_chunks)
|
55 |
+
summary = resume_analyzer.openai(chunks=pdf_chunks, analyze=summary_prompt)
|
56 |
+
if summary:
|
57 |
+
st.session_state['resume_data'] = {
|
58 |
+
'pdf': pdf,
|
59 |
+
'chunks': pdf_chunks,
|
60 |
+
'summary': summary
|
61 |
+
}
|
62 |
+
return True
|
63 |
+
except Exception as e:
|
64 |
+
st.markdown(f'<h5 style="text-align: center;color: orange;">{e}</h5>', unsafe_allow_html=True)
|
65 |
+
return False
|
66 |
+
|
67 |
class resume_analyzer:
|
68 |
def pdf_to_chunks(pdf):
|
69 |
pdf_reader = PdfReader(pdf)
|
|
|
102 |
def resume_summary():
|
103 |
with st.form(key='Summary'):
|
104 |
add_vertical_space(1)
|
105 |
+
if 'resume_data' not in st.session_state:
|
106 |
+
pdf = st.file_uploader(label='Upload Your Resume', type='pdf')
|
107 |
+
add_vertical_space(2)
|
108 |
+
submit = st.form_submit_button(label='Submit')
|
109 |
+
add_vertical_space(1)
|
110 |
+
else:
|
111 |
+
st.info("Using previously uploaded resume")
|
112 |
+
submit = st.form_submit_button(label='Analyze Again')
|
113 |
+
add_vertical_space(1)
|
114 |
|
115 |
add_vertical_space(3)
|
116 |
if submit:
|
117 |
+
if 'resume_data' not in st.session_state:
|
118 |
+
if pdf is not None:
|
119 |
+
if process_resume(pdf):
|
120 |
+
st.markdown(f'<h4 style="color: orange;">Summary:</h4>', unsafe_allow_html=True)
|
121 |
+
st.write(st.session_state['resume_data']['summary'])
|
122 |
+
else:
|
123 |
+
st.markdown(f'<h4 style="color: orange;">Summary:</h4>', unsafe_allow_html=True)
|
124 |
+
st.write(st.session_state['resume_data']['summary'])
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
def strength_prompt(query_with_chunks):
|
127 |
query = f'''need to detailed analysis and explain of the strength of below resume and finally conclude them
|
|
|
134 |
def resume_strength():
|
135 |
with st.form(key='Strength'):
|
136 |
add_vertical_space(1)
|
137 |
+
if 'resume_data' not in st.session_state:
|
138 |
+
pdf = st.file_uploader(label='Upload Your Resume', type='pdf')
|
139 |
+
add_vertical_space(2)
|
140 |
+
submit = st.form_submit_button(label='Submit')
|
141 |
+
add_vertical_space(1)
|
142 |
+
else:
|
143 |
+
st.info("Using previously uploaded resume")
|
144 |
+
submit = st.form_submit_button(label='Analyze Again')
|
145 |
+
add_vertical_space(1)
|
146 |
|
147 |
add_vertical_space(3)
|
148 |
if submit:
|
149 |
+
if 'resume_data' not in st.session_state:
|
150 |
+
if pdf is not None:
|
151 |
+
if process_resume(pdf):
|
152 |
+
strength_prompt = resume_analyzer.strength_prompt(query_with_chunks=st.session_state['resume_data']['summary'])
|
153 |
+
strength = resume_analyzer.openai(chunks=st.session_state['resume_data']['chunks'], analyze=strength_prompt)
|
154 |
+
if strength:
|
155 |
+
st.markdown(f'<h4 style="color: orange;">Strength:</h4>', unsafe_allow_html=True)
|
156 |
+
st.write(strength)
|
157 |
+
else:
|
158 |
+
strength_prompt = resume_analyzer.strength_prompt(query_with_chunks=st.session_state['resume_data']['summary'])
|
159 |
+
strength = resume_analyzer.openai(chunks=st.session_state['resume_data']['chunks'], analyze=strength_prompt)
|
160 |
+
if strength:
|
161 |
+
st.markdown(f'<h4 style="color: orange;">Strength:</h4>', unsafe_allow_html=True)
|
162 |
+
st.write(strength)
|
|
|
|
|
163 |
|
164 |
def weakness_prompt(query_with_chunks):
|
165 |
query = f'''need to detailed analysis and explain of the weakness of below resume and how to improve make a better resume.
|
|
|
171 |
def resume_weakness():
|
172 |
with st.form(key='Weakness'):
|
173 |
add_vertical_space(1)
|
174 |
+
if 'resume_data' not in st.session_state:
|
175 |
+
pdf = st.file_uploader(label='Upload Your Resume', type='pdf')
|
176 |
+
add_vertical_space(2)
|
177 |
+
submit = st.form_submit_button(label='Submit')
|
178 |
+
add_vertical_space(1)
|
179 |
+
else:
|
180 |
+
st.info("Using previously uploaded resume")
|
181 |
+
submit = st.form_submit_button(label='Analyze Again')
|
182 |
+
add_vertical_space(1)
|
183 |
|
184 |
add_vertical_space(3)
|
185 |
if submit:
|
186 |
+
if 'resume_data' not in st.session_state:
|
187 |
+
if pdf is not None:
|
188 |
+
if process_resume(pdf):
|
189 |
+
weakness_prompt = resume_analyzer.weakness_prompt(query_with_chunks=st.session_state['resume_data']['summary'])
|
190 |
+
weakness = resume_analyzer.openai(chunks=st.session_state['resume_data']['chunks'], analyze=weakness_prompt)
|
191 |
+
if weakness:
|
192 |
+
st.markdown(f'<h4 style="color: orange;">Weakness and Suggestions:</h4>', unsafe_allow_html=True)
|
193 |
+
st.write(weakness)
|
194 |
+
else:
|
195 |
+
weakness_prompt = resume_analyzer.weakness_prompt(query_with_chunks=st.session_state['resume_data']['summary'])
|
196 |
+
weakness = resume_analyzer.openai(chunks=st.session_state['resume_data']['chunks'], analyze=weakness_prompt)
|
197 |
+
if weakness:
|
198 |
+
st.markdown(f'<h4 style="color: orange;">Weakness and Suggestions:</h4>', unsafe_allow_html=True)
|
199 |
+
st.write(weakness)
|
|
|
|
|
200 |
|
201 |
def job_title_prompt(query_with_chunks):
|
202 |
query = f''' what are the job roles i apply to likedin based on below?
|
|
|
209 |
def job_title_suggestion():
|
210 |
with st.form(key='Job Titles'):
|
211 |
add_vertical_space(1)
|
212 |
+
if 'resume_data' not in st.session_state:
|
213 |
+
pdf = st.file_uploader(label='Upload Your Resume', type='pdf')
|
214 |
+
add_vertical_space(2)
|
215 |
+
submit = st.form_submit_button(label='Submit')
|
216 |
+
add_vertical_space(1)
|
217 |
+
else:
|
218 |
+
st.info("Using previously uploaded resume")
|
219 |
+
submit = st.form_submit_button(label='Analyze Again')
|
220 |
+
add_vertical_space(1)
|
221 |
|
222 |
add_vertical_space(3)
|
223 |
if submit:
|
224 |
+
if 'resume_data' not in st.session_state:
|
225 |
+
if pdf is not None:
|
226 |
+
if process_resume(pdf):
|
227 |
+
job_title_prompt = resume_analyzer.job_title_prompt(query_with_chunks=st.session_state['resume_data']['summary'])
|
228 |
+
job_title = resume_analyzer.openai(chunks=st.session_state['resume_data']['chunks'], analyze=job_title_prompt)
|
229 |
+
if job_title:
|
230 |
+
st.markdown(f'<h4 style="color: orange;">Job Titles:</h4>', unsafe_allow_html=True)
|
231 |
+
st.write(job_title)
|
232 |
+
else:
|
233 |
+
job_title_prompt = resume_analyzer.job_title_prompt(query_with_chunks=st.session_state['resume_data']['summary'])
|
234 |
+
job_title = resume_analyzer.openai(chunks=st.session_state['resume_data']['chunks'], analyze=job_title_prompt)
|
235 |
+
if job_title:
|
236 |
+
st.markdown(f'<h4 style="color: orange;">Job Titles:</h4>', unsafe_allow_html=True)
|
237 |
+
st.write(job_title)
|
|
|
|
|
238 |
|
239 |
class linkedin_scraper:
|
240 |
def webdriver_setup():
|