Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import json
|
|
|
2 |
import os
|
3 |
import fitz # PyMuPDF for PDF parsing
|
4 |
import docx
|
@@ -7,6 +8,7 @@ from google import genai
|
|
7 |
from google.genai import types
|
8 |
|
9 |
# API key as envirnomental varibale
|
|
|
10 |
api_key = os.environ.get("GOOGLE_API_KEY")
|
11 |
|
12 |
|
@@ -64,74 +66,12 @@ def extract_resume_data(resume_text):
|
|
64 |
return response.text # Gemini will return structured JSON
|
65 |
|
66 |
|
67 |
-
# Define the system instruction
|
68 |
-
sys_instruct_gen = """
|
69 |
-
You are an AI assistant tasked with drafting a professional and personalized email to a hiring manager
|
70 |
-
expressing interest in a job opportunity at their company.
|
71 |
-
You need to adjust accordingly with grammar and spot possible areas where the info in the resume and that of the hiring manager/recruiter are relavent.
|
72 |
-
Make the email such that it piques the interest of the hiring manger, such as a certain skill set they need or can be of great value to them.
|
73 |
-
The email should adhere to the following template and should generate in 260 - 280 words consistently, with placeholders to be filled accordingly:
|
74 |
-
|
75 |
-
Subject: Seeking Opportunities to Contribute at {Company Name}
|
76 |
-
|
77 |
-
Dear {Hiring Manager's Name},
|
78 |
-
|
79 |
-
I hope this email finds you well. My name is [Extract Full Name from Resume], and I am writing to express my keen interest in exploring career opportunities at {Company Name}. Your organization's work in {Industry/Field} has greatly impressed me, particularly your contributions to {Specific Projects, Innovations, or Company Achievements}.
|
80 |
-
|
81 |
-
With a background in [Extract Academic Background: degree, university, and GPA], I have developed strong skills in [Extract Relevant Technical Skills] and gained hands-on experience through projects such as [Extract Relevant Projects from Resume]. My expertise in {Specific Skills or Tools Relevant to the Job} aligns well with the work being done at your company, and I am eager to bring my knowledge and passion to your team.
|
82 |
-
|
83 |
-
Additionally, my certification in Practical AI with Python showcases my commitment to continuous learning in AI and data-driven solutions. Furthermore, my proficiency in Japanese, certified by the JLPT N3, allows me to collaborate effectively in diverse and international work environments.
|
84 |
-
|
85 |
-
I am particularly interested in {Specific Roles, Teams, or Projects at the Company} and believe that my skills in {Extract Skills from Resume} would allow me to contribute meaningfully to your organization's goals. I have attached my resume for your review and would welcome the opportunity to discuss how my experience and expertise align with your company’s needs.
|
86 |
-
|
87 |
-
Thank you for your time and consideration. I look forward to the possibility of joining {Company Name} and contributing to its continued success.
|
88 |
-
|
89 |
-
Best regards,
|
90 |
-
[Extract Full Name from Resume]
|
91 |
-
|
92 |
-
Resume:
|
93 |
-
{}
|
94 |
-
|
95 |
-
"""
|
96 |
-
|
97 |
-
sys_instruct_jap = """
|
98 |
-
You are an AI assistant tasked with drafting a professional and personalized email to a hiring manager
|
99 |
-
expressing interest in a job opportunity at their company.
|
100 |
-
You need to adjust accordingly with grammar and spot possible areas where the info in the resume and that of the hiring manager/recruiter are relavent.
|
101 |
-
Make the email such that it piques the interest of the hiring manger, such as a certain skill set they need or can be of great value to them.
|
102 |
-
Always include japanese language point present in the template.
|
103 |
-
The email should adhere to the following template and should generate in 240 - 260 words consistently, with placeholders to be filled accordingly:
|
104 |
-
|
105 |
-
Subject: Seeking Opportunities to Contribute at {Company Name}
|
106 |
-
|
107 |
-
Dear {Hiring Manager's Name},
|
108 |
-
|
109 |
-
I hope this email finds you well. My name is [Extract Full Name from Resume], and I am writing to express my keen interest in exploring career opportunities at {Company Name}. Your organization's work in {Industry/Field} has greatly impressed me, particularly your contributions to {Specific Projects, Innovations, or Company Achievements}.
|
110 |
-
|
111 |
-
With a background in [Extract Academic Background: degree, university, and GPA], I have developed strong skills in [Extract Relevant Technical Skills] and gained hands-on experience through projects such as [Extract Relevant Projects from Resume].
|
112 |
-
|
113 |
-
My expertise in {Specific Skills or Tools Relevant to the Job} aligns well with the work being done at your company, and I am eager to bring my knowledge and passion to your team.
|
114 |
-
|
115 |
-
Furthermore, my proficiency in Japanese, certified by the JLPT N3, allows me to collaborate effectively in diverse and international work environments.
|
116 |
-
|
117 |
-
I am particularly interested in {Specific Roles, Teams, or Projects at the Company} and believe that my skills in {Extract Skills from Resume} would allow me to contribute meaningfully to your organization's goals. I have attached my resume for your review and would welcome the opportunity to discuss how my experience and expertise align with your company’s needs.
|
118 |
-
|
119 |
-
Thank you for your time and consideration. I look forward to the possibility of joining {Company Name} and contributing to its continued success.
|
120 |
-
|
121 |
-
Best regards,
|
122 |
-
[Extract Full Name from Resume]
|
123 |
-
|
124 |
-
Resume:
|
125 |
-
{}
|
126 |
-
|
127 |
-
"""
|
128 |
-
|
129 |
# Response Pipeline
|
130 |
-
def generate_email(prompt):
|
131 |
client = genai.Client(api_key=api_key)
|
132 |
response = client.models.generate_content(
|
133 |
model="gemini-2.0-flash",
|
134 |
-
config=types.GenerateContentConfig(system_instruction=
|
135 |
contents=[prompt],
|
136 |
)
|
137 |
-
return response.text
|
|
|
1 |
import json
|
2 |
+
import access_token
|
3 |
import os
|
4 |
import fitz # PyMuPDF for PDF parsing
|
5 |
import docx
|
|
|
8 |
from google.genai import types
|
9 |
|
10 |
# API key as envirnomental varibale
|
11 |
+
os.environ["GOOGLE_API_KEY"] = access_token.GOOGLE_API_KEY
|
12 |
api_key = os.environ.get("GOOGLE_API_KEY")
|
13 |
|
14 |
|
|
|
66 |
return response.text # Gemini will return structured JSON
|
67 |
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
# Response Pipeline
|
70 |
+
def generate_email(prompt, template):
|
71 |
client = genai.Client(api_key=api_key)
|
72 |
response = client.models.generate_content(
|
73 |
model="gemini-2.0-flash",
|
74 |
+
config=types.GenerateContentConfig(system_instruction=template),
|
75 |
contents=[prompt],
|
76 |
)
|
77 |
+
return response.text
|