siddhartharya commited on
Commit
31f8b4d
·
verified ·
1 Parent(s): b670fd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -11,8 +11,8 @@ def fetch_public_data(name, dob, city):
11
  # Simulate fetched bio data for demonstration purposes
12
  bio = f"{name} is a software engineer from {city} with over 10 years of experience. Known for work in AI, cloud computing, and leadership in various engineering teams."
13
 
14
- # Simulate LinkedIn profile scraping (replace this with actual scraping logic)
15
- linkedin_profile = f"https://linkedin.com/in/{name.replace(' ', '').lower()}"
16
 
17
  return bio, linkedin_profile
18
 
@@ -63,13 +63,13 @@ def validate_dob(dob):
63
  return False
64
 
65
  # Main function to create the email and allow for saving, editing, or copying
66
- def create_email(name, dob, city, company_name, role, email, phone):
67
  # Validate the DOB format (DD-MM-YYYY)
68
  if not validate_dob(dob):
69
  return "Invalid Date of Birth format. Please use DD-MM-YYYY."
70
 
71
- # Step 1: Fetch public data based on user info
72
- bio, linkedin_profile = fetch_public_data(name, dob, city)
73
 
74
  # Step 2: Generate the email using Groq Cloud LLM
75
  generated_email = generate_and_correct_email(bio, company_name, role)
@@ -92,6 +92,7 @@ def gradio_ui():
92
 
93
  email_input = gr.Textbox(label="Email Address", placeholder="Enter your email address")
94
  phone_input = gr.Textbox(label="Phone Number", placeholder="Enter your phone number")
 
95
 
96
  # Define output for the generated email
97
  email_output = gr.Textbox(label="Generated Email", placeholder="Your generated email will appear here", lines=10)
@@ -99,7 +100,7 @@ def gradio_ui():
99
  # Create the Gradio interface
100
  demo = gr.Interface(
101
  fn=create_email, # Function to call when the user submits
102
- inputs=[name_input, dob_input, city_input, company_name_input, role_input, email_input, phone_input],
103
  outputs=[email_output],
104
  title="Email Writing AI Agent",
105
  description="Generate a professional email for a job application by providing your basic info.",
 
11
  # Simulate fetched bio data for demonstration purposes
12
  bio = f"{name} is a software engineer from {city} with over 10 years of experience. Known for work in AI, cloud computing, and leadership in various engineering teams."
13
 
14
+ # Since we're asking the user to input their LinkedIn URL, we'll no longer scrape LinkedIn.
15
+ linkedin_profile = None
16
 
17
  return bio, linkedin_profile
18
 
 
63
  return False
64
 
65
  # Main function to create the email and allow for saving, editing, or copying
66
+ def create_email(name, dob, city, company_name, role, email, phone, linkedin_profile):
67
  # Validate the DOB format (DD-MM-YYYY)
68
  if not validate_dob(dob):
69
  return "Invalid Date of Birth format. Please use DD-MM-YYYY."
70
 
71
+ # Step 1: Fetch public data based on user info (no need to scrape LinkedIn anymore)
72
+ bio, _ = fetch_public_data(name, dob, city) # We'll use the provided LinkedIn URL
73
 
74
  # Step 2: Generate the email using Groq Cloud LLM
75
  generated_email = generate_and_correct_email(bio, company_name, role)
 
92
 
93
  email_input = gr.Textbox(label="Email Address", placeholder="Enter your email address")
94
  phone_input = gr.Textbox(label="Phone Number", placeholder="Enter your phone number")
95
+ linkedin_input = gr.Textbox(label="LinkedIn URL", placeholder="Enter your LinkedIn profile URL") # New input field for LinkedIn URL
96
 
97
  # Define output for the generated email
98
  email_output = gr.Textbox(label="Generated Email", placeholder="Your generated email will appear here", lines=10)
 
100
  # Create the Gradio interface
101
  demo = gr.Interface(
102
  fn=create_email, # Function to call when the user submits
103
+ inputs=[name_input, dob_input, city_input, company_name_input, role_input, email_input, phone_input, linkedin_input],
104
  outputs=[email_output],
105
  title="Email Writing AI Agent",
106
  description="Generate a professional email for a job application by providing your basic info.",