Update app.py
Browse files
app.py
CHANGED
|
@@ -42,17 +42,20 @@ def check_grammar(email_text):
|
|
| 42 |
return corrected_text
|
| 43 |
|
| 44 |
# Main function to create the email and allow for saving, editing, or copying
|
| 45 |
-
def create_email(name, dob, city, company_name, role):
|
| 46 |
# Step 1: Fetch public data based on user info
|
| 47 |
bio = fetch_public_data(name, dob, city)
|
| 48 |
|
| 49 |
# Step 2: Generate the email using Groq Cloud LLM
|
| 50 |
generated_email = generate_email_from_groq(bio, company_name, role)
|
| 51 |
|
| 52 |
-
# Step 3:
|
| 53 |
-
|
| 54 |
|
| 55 |
-
#
|
|
|
|
|
|
|
|
|
|
| 56 |
return polished_email
|
| 57 |
|
| 58 |
# Define interface with Gradio
|
|
@@ -64,14 +67,18 @@ def gradio_ui():
|
|
| 64 |
|
| 65 |
company_name_input = gr.Textbox(label="Company Name", placeholder="Enter the name of the company you are applying to")
|
| 66 |
role_input = gr.Textbox(label="Role", placeholder="Enter the role you are applying for")
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
# Define output for the generated email
|
| 69 |
email_output = gr.Textbox(label="Generated Email", placeholder="Your generated email will appear here", lines=10)
|
| 70 |
|
| 71 |
# Create the Gradio interface
|
| 72 |
demo = gr.Interface(
|
| 73 |
fn=create_email, # Function to call when the user submits
|
| 74 |
-
inputs=[name_input, dob_input, city_input, company_name_input, role_input],
|
| 75 |
outputs=[email_output],
|
| 76 |
title="Email Writing AI Agent",
|
| 77 |
description="Generate a professional email for a job application by providing your basic info.",
|
|
|
|
| 42 |
return corrected_text
|
| 43 |
|
| 44 |
# Main function to create the email and allow for saving, editing, or copying
|
| 45 |
+
def create_email(name, dob, city, company_name, role, email, phone, linkedin):
|
| 46 |
# Step 1: Fetch public data based on user info
|
| 47 |
bio = fetch_public_data(name, dob, city)
|
| 48 |
|
| 49 |
# Step 2: Generate the email using Groq Cloud LLM
|
| 50 |
generated_email = generate_email_from_groq(bio, company_name, role)
|
| 51 |
|
| 52 |
+
# Step 3: Add the user's email, phone number, and LinkedIn profile to the signature
|
| 53 |
+
signature = f"\n\nBest regards,\n{name}\nEmail: {email}\nPhone: {phone}\nLinkedIn: {linkedin}"
|
| 54 |
|
| 55 |
+
# Step 4: Run grammar and tone check
|
| 56 |
+
polished_email = check_grammar(generated_email + signature)
|
| 57 |
+
|
| 58 |
+
# Return the final polished email with the signature
|
| 59 |
return polished_email
|
| 60 |
|
| 61 |
# Define interface with Gradio
|
|
|
|
| 67 |
|
| 68 |
company_name_input = gr.Textbox(label="Company Name", placeholder="Enter the name of the company you are applying to")
|
| 69 |
role_input = gr.Textbox(label="Role", placeholder="Enter the role you are applying for")
|
| 70 |
+
|
| 71 |
+
email_input = gr.Textbox(label="Email Address", placeholder="Enter your email address")
|
| 72 |
+
phone_input = gr.Textbox(label="Phone Number", placeholder="Enter your phone number")
|
| 73 |
+
linkedin_input = gr.Textbox(label="LinkedIn Profile URL", placeholder="Enter your LinkedIn profile link")
|
| 74 |
+
|
| 75 |
# Define output for the generated email
|
| 76 |
email_output = gr.Textbox(label="Generated Email", placeholder="Your generated email will appear here", lines=10)
|
| 77 |
|
| 78 |
# Create the Gradio interface
|
| 79 |
demo = gr.Interface(
|
| 80 |
fn=create_email, # Function to call when the user submits
|
| 81 |
+
inputs=[name_input, dob_input, city_input, company_name_input, role_input, email_input, phone_input, linkedin_input],
|
| 82 |
outputs=[email_output],
|
| 83 |
title="Email Writing AI Agent",
|
| 84 |
description="Generate a professional email for a job application by providing your basic info.",
|