Dhahlan2000 commited on
Commit
9a4471a
·
1 Parent(s): 204d33b

Refactor app.py to enhance the Streamlit UI for the AI Job Application Email Generator. Updated the update_ui function to accept parameters for message, cv_file, and cv_sections, improving the handling of user inputs. Reorganized the layout to ensure a smoother flow for CV uploads and job description input, while maintaining clear feedback for users. This change streamlines the email generation process and improves overall user experience.

Browse files
Files changed (1) hide show
  1. app.py +26 -22
app.py CHANGED
@@ -172,28 +172,8 @@ CV Summary:
172
  # Streamlit UI section
173
  st.title("AI Job Application Email Generator")
174
 
175
- # Add tabs for different sections
176
- tab1, tab2 = st.tabs(["Generate Email", "View CV Details"])
177
-
178
- with tab1:
179
- # CV file upload
180
- cv_file = st.file_uploader("Upload CV (PDF or DOCX)", type=["pdf", "docx"])
181
-
182
- if cv_file:
183
- cv_sections = extract_cv_text(cv_file)
184
- if isinstance(cv_sections, dict):
185
- st.success("CV uploaded and parsed successfully!")
186
- else:
187
- st.error(cv_sections)
188
-
189
- # Job description input
190
- st.markdown("### Job Description")
191
- message = st.text_area("Paste the job description here:", height=200)
192
-
193
- # Call the updated UI function
194
- update_ui()
195
-
196
- def update_ui():
197
  # Create placeholder for the generated email
198
  email_placeholder = st.empty()
199
 
@@ -215,6 +195,30 @@ def update_ui():
215
  else:
216
  st.warning("Please upload a CV and enter a job description.")
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  with tab2:
219
  if cv_file and isinstance(cv_sections, dict):
220
  st.markdown("### Parsed CV Details")
 
172
  # Streamlit UI section
173
  st.title("AI Job Application Email Generator")
174
 
175
+ def update_ui(message, cv_file, cv_sections):
176
+ """Handle the UI updates for email generation."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  # Create placeholder for the generated email
178
  email_placeholder = st.empty()
179
 
 
195
  else:
196
  st.warning("Please upload a CV and enter a job description.")
197
 
198
+ # Add tabs for different sections
199
+ tab1, tab2 = st.tabs(["Generate Email", "View CV Details"])
200
+
201
+ with tab1:
202
+ # CV file upload
203
+ cv_file = st.file_uploader("Upload CV (PDF or DOCX)", type=["pdf", "docx"])
204
+
205
+ if cv_file:
206
+ cv_sections = extract_cv_text(cv_file)
207
+ if isinstance(cv_sections, dict):
208
+ st.success("CV uploaded and parsed successfully!")
209
+ else:
210
+ st.error(cv_sections)
211
+ cv_sections = None
212
+ else:
213
+ cv_sections = None
214
+
215
+ # Job description input
216
+ st.markdown("### Job Description")
217
+ message = st.text_area("Paste the job description here:", height=200)
218
+
219
+ # Call the updated UI function with parameters
220
+ update_ui(message, cv_file, cv_sections)
221
+
222
  with tab2:
223
  if cv_file and isinstance(cv_sections, dict):
224
  st.markdown("### Parsed CV Details")