datascientist22
commited on
Commit
β’
63fbb09
1
Parent(s):
1386d9b
Update app.py
Browse files
app.py
CHANGED
@@ -57,9 +57,16 @@ with st.sidebar:
|
|
57 |
}
|
58 |
</style>
|
59 |
""", unsafe_allow_html=True)
|
60 |
-
job_description = st.text_area("Paste the Job Description here", placeholder="Enter the job description you're applying for...", height=200, key="job_description", help="Provide the job description for matching with your resume.")
|
61 |
|
62 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
if "name" not in st.session_state:
|
64 |
st.session_state["name"] = ""
|
65 |
if "contact" not in st.session_state:
|
@@ -176,38 +183,21 @@ if "api_key" in st.session_state:
|
|
176 |
|
177 |
# Cover Letter Section
|
178 |
st.subheader("π© Generate Cover Letter")
|
|
|
|
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
if submit_cover_letter and job_title and company_name and company_address:
|
189 |
-
# Create a prompt to generate the cover letter
|
190 |
-
cover_letter_prompt = f"""
|
191 |
-
Write a {cover_letter_style.lower()} cover letter for a job application.
|
192 |
-
|
193 |
-
Name: {st.session_state['name']}
|
194 |
-
Contact: {st.session_state['contact']}
|
195 |
-
Job Title: {job_title}
|
196 |
-
Company Name: {company_name}
|
197 |
-
Company Address: {company_address}
|
198 |
-
|
199 |
-
Cover Letter:
|
200 |
-
- Begin with a greeting.
|
201 |
-
- Mention the position you're applying for.
|
202 |
-
- Explain why you're a good fit for the role.
|
203 |
-
- Include any relevant experiences or skills.
|
204 |
-
- End with a polite closing.
|
205 |
-
"""
|
206 |
|
207 |
-
|
208 |
-
|
|
|
|
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
st.text_area("Your Cover Letter", cover_letter_output.content, height=400)
|
213 |
-
st.button("π Copy Cover Letter to Clipboard")
|
|
|
57 |
}
|
58 |
</style>
|
59 |
""", unsafe_allow_html=True)
|
|
|
60 |
|
61 |
+
# Ensure the default value is fetched from session state if it exists
|
62 |
+
job_description = st.text_area("Paste the Job Description here",
|
63 |
+
placeholder="Enter the job description you're applying for...",
|
64 |
+
height=200,
|
65 |
+
key="job_description",
|
66 |
+
help="Provide the job description for matching with your resume.",
|
67 |
+
value=st.session_state.get("job_description", ""))
|
68 |
+
|
69 |
+
# Initialize other session state variables if not present
|
70 |
if "name" not in st.session_state:
|
71 |
st.session_state["name"] = ""
|
72 |
if "contact" not in st.session_state:
|
|
|
183 |
|
184 |
# Cover Letter Section
|
185 |
st.subheader("π© Generate Cover Letter")
|
186 |
+
cover_letter_prompt = f"""
|
187 |
+
Create a cover letter for {st.session_state['name']} for the following job description:
|
188 |
|
189 |
+
Job Description: {st.session_state['job_description']}
|
190 |
+
|
191 |
+
Ensure the cover letter is professional and tailored to the job.
|
192 |
+
"""
|
193 |
+
|
194 |
+
# Generate cover letter using ChatCohere
|
195 |
+
cover_letter_output = chat_model.invoke(input=cover_letter_prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
+
# Display the generated cover letter
|
198 |
+
st.subheader("π Generated Cover Letter")
|
199 |
+
st.text_area("Your Cover Letter", cover_letter_output.content, height=400)
|
200 |
+
st.button("π Copy Cover Letter to Clipboard")
|
201 |
|
202 |
+
else:
|
203 |
+
st.warning("β οΈ Please enter your details in the sidebar.")
|
|
|
|