siddhartharya
commited on
Commit
•
bc40ada
1
Parent(s):
b6a2224
Update app.py
Browse files
app.py
CHANGED
@@ -125,6 +125,9 @@ class EmailAgent:
|
|
125 |
def generate_email(self):
|
126 |
print("Action: Generating the email with the gathered information.")
|
127 |
|
|
|
|
|
|
|
128 |
# Dynamic LLM prompt
|
129 |
prompt = f"""
|
130 |
Write a professional email applying for the {self.role} position at {self.company_name}.
|
@@ -138,6 +141,10 @@ class EmailAgent:
|
|
138 |
|
139 |
Tailor the email dynamically to the role of **{self.role}** at {self.company_name}, aligning the candidate's skills and experiences with the expected responsibilities of the role and the company’s operations.
|
140 |
|
|
|
|
|
|
|
|
|
141 |
End the email with this signature:
|
142 |
Best regards,
|
143 |
{self.user_name}
|
@@ -190,24 +197,3 @@ def gradio_ui():
|
|
190 |
# Output field
|
191 |
email_output = gr.Textbox(label="Generated Email", placeholder="Your generated email will appear here", lines=10)
|
192 |
|
193 |
-
# Function to create and run the email agent
|
194 |
-
def create_email(name, company_name, role, email, phone, linkedin_url, word_limit):
|
195 |
-
agent = EmailAgent(linkedin_url, company_name, role, word_limit, name, email, phone, linkedin_url)
|
196 |
-
return agent.run()
|
197 |
-
|
198 |
-
# Gradio interface
|
199 |
-
demo = gr.Interface(
|
200 |
-
fn=create_email,
|
201 |
-
inputs=[name_input, company_input, role_input, email_input, phone_input, linkedin_input, word_limit_slider],
|
202 |
-
outputs=[email_output],
|
203 |
-
title="Email Writing AI Agent with ReAct",
|
204 |
-
description="Generate a professional email for a job application using LinkedIn data, company info, and role description.",
|
205 |
-
allow_flagging="never"
|
206 |
-
)
|
207 |
-
|
208 |
-
# Launch the Gradio app
|
209 |
-
demo.launch()
|
210 |
-
|
211 |
-
# Start the Gradio app when running the script
|
212 |
-
if __name__ == "__main__":
|
213 |
-
gradio_ui()
|
|
|
125 |
def generate_email(self):
|
126 |
print("Action: Generating the email with the gathered information.")
|
127 |
|
128 |
+
# Use the LinkedIn profile link dynamically in the body
|
129 |
+
linkedin_text = f"Please find my LinkedIn profile at {self.linkedin}" if self.linkedin else ""
|
130 |
+
|
131 |
# Dynamic LLM prompt
|
132 |
prompt = f"""
|
133 |
Write a professional email applying for the {self.role} position at {self.company_name}.
|
|
|
141 |
|
142 |
Tailor the email dynamically to the role of **{self.role}** at {self.company_name}, aligning the candidate's skills and experiences with the expected responsibilities of the role and the company’s operations.
|
143 |
|
144 |
+
{linkedin_text}
|
145 |
+
|
146 |
+
Remove references to job posting sources unless provided. Use the LinkedIn URL for the candidate and do not include placeholders.
|
147 |
+
|
148 |
End the email with this signature:
|
149 |
Best regards,
|
150 |
{self.user_name}
|
|
|
197 |
# Output field
|
198 |
email_output = gr.Textbox(label="Generated Email", placeholder="Your generated email will appear here", lines=10)
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|