hruday96 commited on
Commit
e7cb1d2
·
verified ·
1 Parent(s): 64df11f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -2
app.py CHANGED
@@ -45,6 +45,40 @@ if linkedin_invite or email_invite or whatsapp_invite:
45
  message_type = "WhatsApp Invite"
46
  st.info(f"Generating {message_type}...")
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
-
50
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  message_type = "WhatsApp Invite"
46
  st.info(f"Generating {message_type}...")
47
 
48
+ # Construct the prompt for analysis
49
+ prompt = f"""
50
+ You are an expert copywriter and hiring manager assistant. Analyze the following details and provide a structured response in the specified format:
51
+
52
+ Candidate Details:
53
+ - Name: {candidate_name}
54
+ - Designation: {candidate_designation}
55
+ - Details: {candidate_details}
56
+
57
+ Job Description:
58
+ {job_description}
59
+
60
+ ### Tasks:
61
+ 1. Create a personalized {message_type.lower()} message for candidate outreach.
62
+ 2. Ensure the tone is {selected_tone.lower()} and aligns with professional standards.
63
+ 3. Provide a brief summary of why the candidate is a good fit for the job based on their details.
64
+ """
65
+
66
+ try:
67
+ # Initialize the generative model
68
+ model = genai.GenerativeModel("gemini-pro")
69
 
70
+ # Generate content using the Gemini API
71
+ response = model.generate_content(
72
+ prompt,
73
+ generation_config=genai.types.GenerationConfig(
74
+ temperature=0.0, # Ensures deterministic output
75
+ max_output_tokens=500, # Limits the response length to 500 tokens
76
+ candidate_count=1 # Generates only one candidate
77
+ )
78
+ )
79
+
80
+ # Display the generated message
81
+ st.success(f"{message_type} Generated:")
82
+ st.write(generated_message)
83
+ except Exception as e:
84
+ st.error(f"An error occurred while generating the message: {e}")