Spaces:
Running
Running
File size: 4,547 Bytes
5302799 b89bba2 5302799 66bf5cc c9c2072 97ad829 66bf5cc c9052ff 66bf5cc ed7680f 66bf5cc c9c2072 66bf5cc ed7680f 5302799 5e65c0a 66bf5cc 976c3d7 ed7680f 66bf5cc c9c2072 66bf5cc ed7680f 5302799 66bf5cc ed7680f 66bf5cc c9c2072 66bf5cc ed7680f 5302799 66bf5cc c9c2072 66bf5cc 5302799 c20e759 5302799 c20e759 5302799 c20e759 ed7680f 5302799 c20e759 5302799 5e65c0a c20e759 5e65c0a 5302799 c20e759 5302799 c20e759 ed7680f 5302799 c20e759 5302799 c20e759 5302799 c20e759 5302799 c9c2072 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
import gradio as gr
from huggingface_hub import InferenceClient
from PyPDF2 import PdfReader
# Initialize the Inference Client
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
def extract_text_from_pdf(file):
if file is None:
return ""
reader = PdfReader(file)
text = ""
for page in reader.pages:
text += page.extract_text()
return text
def ats_friendly_checker(file):
resume_text = extract_text_from_pdf(file)
system_message = "Evaluate the following resume for ATS-friendliness and provide feedback."
message = resume_text
response = client.chat_completion(
[{"role": "system", "content": system_message}, {"role": "user", "content": message}],
max_tokens=512,
temperature=0.7,
top_p=0.95
).choices[0].message.content
feedback = response
return feedback
def resume_match_checker(file, job_description):
resume_text = extract_text_from_pdf(file)
system_message = "Compare the following resume with the job description and provide feedback."
message = f"Resume: {resume_text}\n\nJob Description: {job_description}"
response = client.chat_completion(
[{"role": "system", "content": system_message}, {"role": "user", "content": message}],
max_tokens=512,
temperature=0.7,
top_p=0.95
).choices[0].message.content
feedback = response
return feedback
def resume_quality_score(file):
resume_text = extract_text_from_pdf(file)
system_message = "Evaluate the following resume for overall quality and provide feedback."
message = resume_text
response = client.chat_completion(
[{"role": "system", "content": system_message}, {"role": "user", "content": message}],
max_tokens=512,
temperature=0.7,
top_p=0.95
).choices[0].message.content
interpretation = response
return interpretation
def text_to_overleaf(resume_text):
system_message = "Convert the following resume text to Overleaf code."
message = resume_text
response = client.chat_completion(
[{"role": "system", "content": system_message}, {"role": "user", "content": message}],
max_tokens=512,
temperature=0.7,
top_p=0.95
).choices[0].message.content
overleaf_code = response
return overleaf_code
# Define the Gradio interface
with gr.Blocks() as demo:
gr.Markdown("""
# Resume Enhancement Tool π
Welcome to the Resume Enhancement Tool! This tool offers several features to help you enhance your resume, ensuring it's ATS-friendly, matches job descriptions, and is of high quality. You can also convert your resume text to Overleaf code for a polished, professional look.
""")
with gr.Tab("ATS-Friendly Checker π"):
with gr.Row():
resume = gr.File(label="Upload your Resume (PDF)")
feedback = gr.Textbox(label="Feedback", interactive=False, lines=15, max_lines=50)
resume.upload(ats_friendly_checker, resume, feedback)
with gr.Tab("Resume Match Checker π"):
with gr.Row():
resume = gr.File(label="Upload your Resume (PDF)")
job_description = gr.Textbox(label="Job Description")
feedback = gr.Textbox(label="Feedback", interactive=False, lines=15, max_lines=50)
gr.Button("Check Match").click(resume_match_checker, [resume, job_description], feedback)
with gr.Tab("Resume Quality Score π"):
with gr.Row():
resume = gr.File(label="Upload your Resume (PDF)")
interpretation = gr.Textbox(label="Interpretation", interactive=False, lines=15, max_lines=50)
resume.upload(resume_quality_score, resume, interpretation)
with gr.Tab("Text to Overleaf Code ποΈ"):
with gr.Row():
resume_text = gr.Textbox(label="Resume Text", placeholder="Enter your resume text here or paste the example below:\n\nJohn Doe\n\nExperience\n- Software Engineer at Company A\n- Data Scientist at Company B\n\nEducation\n- BSc in Computer Science")
overleaf_code = gr.Textbox(label="Overleaf Code", interactive=False, lines=15, max_lines=50)
resume_text.submit(text_to_overleaf, resume_text, overleaf_code)
gr.Markdown("Paste the generated code into [Overleaf](https://www.overleaf.com/) to create your resume.")
gr.Markdown("---\nBuilt with love by [Bahae Eddine HALIM](https://www.linkedin.com/in/halimbahae/)")
if __name__ == "__main__":
demo.launch(share=True)
|