super template pdf
This commit is contained in:
parent
e314cc6ebb
commit
ade22dbd68
8
gpt.py
8
gpt.py
@ -167,17 +167,19 @@ class GPTAnswerer:
|
|||||||
def get_resume_html(self):
|
def get_resume_html(self):
|
||||||
resume_markdown_prompt = ChatPromptTemplate.from_template(strings.resume_markdown_template)
|
resume_markdown_prompt = ChatPromptTemplate.from_template(strings.resume_markdown_template)
|
||||||
fusion_job_description_resume_prompt = ChatPromptTemplate.from_template(strings.fusion_job_description_resume_template)
|
fusion_job_description_resume_prompt = ChatPromptTemplate.from_template(strings.fusion_job_description_resume_template)
|
||||||
|
|
||||||
resume_markdown_chain = resume_markdown_prompt | self.llm_cheap | StrOutputParser()
|
resume_markdown_chain = resume_markdown_prompt | self.llm_cheap | StrOutputParser()
|
||||||
fusion_job_description_resume_chain = fusion_job_description_resume_prompt | self.llm_cheap | StrOutputParser()
|
fusion_job_description_resume_chain = fusion_job_description_resume_prompt | self.llm_cheap | StrOutputParser()
|
||||||
|
|
||||||
#html_template = strings.html_template.format(email_address=self.resume.personal_information.email, phone_number=self.resume.personal_information.phonePrefix + self.resume.personal_information.phone , github_link=self.resume.personal_information.github, linkedin_link=self.resume.personal_information.linkedin,city=self.resume.personal_information.city,country=self.resume.personal_information.country)
|
casual_markdown_path = os.path.abspath("resume_template/casual_markdown.js")
|
||||||
|
reorganize_header_path = os.path.abspath("resume_template/reorganizeHeader.js")
|
||||||
|
resume_css_path = os.path.abspath("resume_template/resume.css")
|
||||||
|
|
||||||
|
html_template = strings.html_template.format(casual_markdown=casual_markdown_path, reorganize_header=reorganize_header_path, resume_css=resume_css_path)
|
||||||
composed_chain = (
|
composed_chain = (
|
||||||
resume_markdown_chain
|
resume_markdown_chain
|
||||||
| (lambda output: {"job_description": self.job.summarize_job_description, "formatted_resume": output})
|
| (lambda output: {"job_description": self.job.summarize_job_description, "formatted_resume": output})
|
||||||
| fusion_job_description_resume_chain
|
| fusion_job_description_resume_chain
|
||||||
| (lambda formatted_resume: strings.html_template + formatted_resume)
|
| (lambda formatted_resume: html_template + formatted_resume)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -87,8 +87,8 @@ class LinkedInEasyApplier:
|
|||||||
|
|
||||||
def _scroll_page(self) -> None:
|
def _scroll_page(self) -> None:
|
||||||
scrollable_element = self.driver.find_element(By.TAG_NAME, 'html')
|
scrollable_element = self.driver.find_element(By.TAG_NAME, 'html')
|
||||||
# utils.scroll_slow(self.driver, scrollable_element, step=300, reverse=False)
|
utils.scroll_slow(self.driver, scrollable_element, step=300, reverse=False)
|
||||||
# utils.scroll_slow(self.driver, scrollable_element, step=300, reverse=True)
|
utils.scroll_slow(self.driver, scrollable_element, step=300, reverse=True)
|
||||||
|
|
||||||
def _fill_application_form(self):
|
def _fill_application_form(self):
|
||||||
while True:
|
while True:
|
||||||
@ -195,9 +195,9 @@ class LinkedInEasyApplier:
|
|||||||
file_path_pdf = os.path.join(folder_path, file_name_pdf)
|
file_path_pdf = os.path.join(folder_path, file_name_pdf)
|
||||||
|
|
||||||
with open(file_path_pdf, "wb") as f:
|
with open(file_path_pdf, "wb") as f:
|
||||||
f.write(base64.b64decode(utils.HTML_to_PDF(file_name_HTML,True)))
|
f.write(base64.b64decode(utils.HTML_to_PDF(file_name_HTML)))
|
||||||
|
|
||||||
element.send_keys(file_path_pdf)
|
element.send_keys(os.path.abspath(file_path_pdf))
|
||||||
time.sleep(2) # Give some time for the upload process
|
time.sleep(2) # Give some time for the upload process
|
||||||
os.remove(file_name_HTML)
|
os.remove(file_name_HTML)
|
||||||
return True
|
return True
|
||||||
|
@ -40,4 +40,4 @@ function reorganizeHeader() {
|
|||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
reorganizeHeader();
|
reorganizeHeader();
|
||||||
}, 100);
|
}, 1000);
|
||||||
|
40
strings.py
40
strings.py
@ -25,6 +25,12 @@ Provide guidance on how to enhance the presentation of the information to maximi
|
|||||||
```
|
```
|
||||||
# [Full Name]
|
# [Full Name]
|
||||||
|
|
||||||
|
[Your City, Your Country](Maps link)
|
||||||
|
[Your Prefix Phone number](tel: Your Prefix Phone number)
|
||||||
|
[Your Email](mailto:Your Email)
|
||||||
|
[LinkedIn](Link LinkedIn account)
|
||||||
|
[GitHub](Link GitHub account)
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
[Brief professional summary highlighting your experience, key skills, and career objectives. 2-3 sentences.]
|
[Brief professional summary highlighting your experience, key skills, and career objectives. 2-3 sentences.]
|
||||||
@ -38,7 +44,7 @@ Provide guidance on how to enhance the presentation of the information to maximi
|
|||||||
- **Skill4:** [details (max 15 word)]
|
- **Skill4:** [details (max 15 word)]
|
||||||
- **Skill5:** [details (max 15 word)]
|
- **Skill5:** [details (max 15 word)]
|
||||||
|
|
||||||
## Professional Experience
|
## Working Experience
|
||||||
|
|
||||||
### [Job Title]
|
### [Job Title]
|
||||||
**[Company Name]** – [City, State]
|
**[Company Name]** – [City, State]
|
||||||
@ -126,39 +132,13 @@ html_template = """
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<title>Resume</title>
|
<title>Resume</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/casualwriter/casual-markdown/dist/casual-markdown.css">
|
<script src="{casual_markdown}"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/gh/casualwriter/casual-markdown/dist/casual-markdown.js"></script>
|
<script src="{reorganize_header}"></script>
|
||||||
<style>
|
<link rel="stylesheet" href="{resume_css}">
|
||||||
body {{ line-height:1.5; margin:auto; padding:3px; max-width:1024px; display:none; FONT-FAMILY:"Segoe UI",ARIAL; }}
|
|
||||||
h1 {{ font-size:200%; padding:16px; border:1px solid lightgrey; BACKGROUND:#f0f0f0; }}
|
|
||||||
h2 {{ border-bottom:1px solid grey; padding:2px }}
|
|
||||||
</style>
|
|
||||||
<body onload="document.body.innerHTML=md.html(document.body.innerHTML); document.body.style.display='block';">
|
<body onload="document.body.innerHTML=md.html(document.body.innerHTML); document.body.style.display='block';">
|
||||||
<span style="float:right; padding:6px; display:block; text-align: center; width:250px;">
|
|
||||||
{email_address} <br> {phone_number} <a href="{github_link}" style="color: #0366d6; text-decoration: none;">GitHub</a> - <a href="{linkedin_link}" style="color: #0366d6; text-decoration: none;">LinkedIn</a>
|
|
||||||
</span>
|
|
||||||
<span style="
|
|
||||||
position: fixed;
|
|
||||||
top: 16.5%;
|
|
||||||
left: 18%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
padding: 6px;
|
|
||||||
text-align: center;
|
|
||||||
z-index: 1000;
|
|
||||||
">
|
|
||||||
{city}, {country}
|
|
||||||
</span>
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Personal Information Template
|
# Personal Information Template
|
||||||
personal_information_template = """
|
personal_information_template = """
|
||||||
Answer the following question based on the provided personal information.
|
Answer the following question based on the provided personal information.
|
||||||
|
6
utils.py
6
utils.py
@ -51,7 +51,7 @@ def scroll_slow(driver, scrollable_element, start=0, end=3600, step=100, reverse
|
|||||||
print(f"Exception occurred: {e}")
|
print(f"Exception occurred: {e}")
|
||||||
|
|
||||||
|
|
||||||
def HTML_to_PDF(FilePath, Hide_Window=True):
|
def HTML_to_PDF(FilePath):
|
||||||
# Validate and prepare file paths
|
# Validate and prepare file paths
|
||||||
if not os.path.isfile(FilePath):
|
if not os.path.isfile(FilePath):
|
||||||
raise FileNotFoundError(f"The specified file does not exist: {FilePath}")
|
raise FileNotFoundError(f"The specified file does not exist: {FilePath}")
|
||||||
@ -60,8 +60,6 @@ def HTML_to_PDF(FilePath, Hide_Window=True):
|
|||||||
|
|
||||||
# Set up Chrome options
|
# Set up Chrome options
|
||||||
chrome_options = webdriver.ChromeOptions()
|
chrome_options = webdriver.ChromeOptions()
|
||||||
if Hide_Window:
|
|
||||||
chrome_options.add_argument("--headless") # Run Chrome in headless mode
|
|
||||||
|
|
||||||
# Initialize Chrome driver
|
# Initialize Chrome driver
|
||||||
service = ChromeService(ChromeDriverManager().install())
|
service = ChromeService(ChromeDriverManager().install())
|
||||||
@ -70,7 +68,7 @@ def HTML_to_PDF(FilePath, Hide_Window=True):
|
|||||||
try:
|
try:
|
||||||
# Load the HTML file
|
# Load the HTML file
|
||||||
driver.get(FilePath)
|
driver.get(FilePath)
|
||||||
|
time.sleep(3) # Adjust the sleep time if necessary
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
pdf_base64 = driver.execute_cdp_cmd("Page.printToPDF", {
|
pdf_base64 = driver.execute_cdp_cmd("Page.printToPDF", {
|
||||||
"printBackground": True, # Incluir los fondos en el PDF
|
"printBackground": True, # Incluir los fondos en el PDF
|
||||||
|
Loading…
Reference in New Issue
Block a user