Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,9 +16,14 @@ def extract_text_from_pdf(file):
|
|
16 |
text += page.extract_text()
|
17 |
return text
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def ats_friendly_checker(file):
|
20 |
resume_text = extract_text_from_pdf(file)
|
21 |
-
# Implement ATS-friendly checker logic using LLM
|
22 |
system_message = "Evaluate the following resume for ATS-friendliness and provide a score and feedback."
|
23 |
message = resume_text
|
24 |
response = client.chat_completion(
|
@@ -28,8 +33,9 @@ def ats_friendly_checker(file):
|
|
28 |
top_p=0.95
|
29 |
).choices[0].message.content
|
30 |
|
31 |
-
|
32 |
feedback = "\n".join(response.split("\n")[1:])
|
|
|
33 |
return score, feedback
|
34 |
|
35 |
def scrape_job_description(url):
|
@@ -41,7 +47,6 @@ def scrape_job_description(url):
|
|
41 |
def resume_match_checker(file, job_url):
|
42 |
resume_text = extract_text_from_pdf(file)
|
43 |
job_description = scrape_job_description(job_url)
|
44 |
-
# Implement resume match checker logic using LLM
|
45 |
system_message = "Compare the following resume with the job description and provide a match score."
|
46 |
message = f"Resume: {resume_text}\n\nJob Description: {job_description}"
|
47 |
response = client.chat_completion(
|
@@ -51,12 +56,12 @@ def resume_match_checker(file, job_url):
|
|
51 |
top_p=0.95
|
52 |
).choices[0].message.content
|
53 |
|
54 |
-
|
|
|
55 |
return match_score
|
56 |
|
57 |
def resume_quality_score(file):
|
58 |
resume_text = extract_text_from_pdf(file)
|
59 |
-
# Implement resume quality scoring logic using LLM
|
60 |
system_message = "Evaluate the following resume for overall quality and provide a score and interpretation."
|
61 |
message = resume_text
|
62 |
response = client.chat_completion(
|
@@ -67,12 +72,12 @@ def resume_quality_score(file):
|
|
67 |
).choices[0].message.content
|
68 |
|
69 |
score_lines = response.split("\n")
|
70 |
-
|
71 |
interpretation = "\n".join(score_lines[1:])
|
|
|
72 |
return quality_score, interpretation
|
73 |
|
74 |
def text_to_overleaf(resume_text):
|
75 |
-
# Implement the conversion to Overleaf code using LLM
|
76 |
system_message = "Convert the following resume text to Overleaf code."
|
77 |
message = resume_text
|
78 |
response = client.chat_completion(
|
@@ -120,6 +125,3 @@ with gr.Blocks() as demo:
|
|
120 |
|
121 |
if __name__ == "__main__":
|
122 |
demo.launch(share=True)
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
16 |
text += page.extract_text()
|
17 |
return text
|
18 |
|
19 |
+
def parse_score(score_text):
|
20 |
+
try:
|
21 |
+
return float(score_text.strip('%').strip()) / 100
|
22 |
+
except ValueError:
|
23 |
+
return None
|
24 |
+
|
25 |
def ats_friendly_checker(file):
|
26 |
resume_text = extract_text_from_pdf(file)
|
|
|
27 |
system_message = "Evaluate the following resume for ATS-friendliness and provide a score and feedback."
|
28 |
message = resume_text
|
29 |
response = client.chat_completion(
|
|
|
33 |
top_p=0.95
|
34 |
).choices[0].message.content
|
35 |
|
36 |
+
score_text = response.split("\n")[0].split(":")[-1].strip()
|
37 |
feedback = "\n".join(response.split("\n")[1:])
|
38 |
+
score = parse_score(score_text) * 100 # Convert to percentage
|
39 |
return score, feedback
|
40 |
|
41 |
def scrape_job_description(url):
|
|
|
47 |
def resume_match_checker(file, job_url):
|
48 |
resume_text = extract_text_from_pdf(file)
|
49 |
job_description = scrape_job_description(job_url)
|
|
|
50 |
system_message = "Compare the following resume with the job description and provide a match score."
|
51 |
message = f"Resume: {resume_text}\n\nJob Description: {job_description}"
|
52 |
response = client.chat_completion(
|
|
|
56 |
top_p=0.95
|
57 |
).choices[0].message.content
|
58 |
|
59 |
+
match_score_text = response.split(":")[-1].strip()
|
60 |
+
match_score = parse_score(match_score_text) * 100 # Convert to percentage
|
61 |
return match_score
|
62 |
|
63 |
def resume_quality_score(file):
|
64 |
resume_text = extract_text_from_pdf(file)
|
|
|
65 |
system_message = "Evaluate the following resume for overall quality and provide a score and interpretation."
|
66 |
message = resume_text
|
67 |
response = client.chat_completion(
|
|
|
72 |
).choices[0].message.content
|
73 |
|
74 |
score_lines = response.split("\n")
|
75 |
+
quality_score_text = score_lines[0].split(":")[-1].strip()
|
76 |
interpretation = "\n".join(score_lines[1:])
|
77 |
+
quality_score = parse_score(quality_score_text) * 100 # Convert to percentage
|
78 |
return quality_score, interpretation
|
79 |
|
80 |
def text_to_overleaf(resume_text):
|
|
|
81 |
system_message = "Convert the following resume text to Overleaf code."
|
82 |
message = resume_text
|
83 |
response = client.chat_completion(
|
|
|
125 |
|
126 |
if __name__ == "__main__":
|
127 |
demo.launch(share=True)
|
|
|
|
|
|