pktpaulie commited on
Commit
7cf954e
·
verified ·
1 Parent(s): fb342d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -236,6 +236,22 @@ def save_bytes_as_pdf(docx_bytes, output_path='output.pdf'):
236
 
237
  # Clean up the temporary directory
238
  os.remove(output_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  def save_docx_as_pdf(input_path, output_path='output.pdf'):
240
  if input_path.lower().endswith('.docx'):
241
  try:
@@ -619,8 +635,8 @@ if uploaded_resume and uploaded_job_description:
619
  st.markdown("### Tailored Resume:")
620
  # display_doc_as_image2(gen_pdf_path)
621
  # display_pdf_pages_as_images(gen_pdf_path)
622
- st.write(generated_resume)
623
-
624
  st.success(f"Download tailored resume")
625
  st.download_button(
626
  label="Generated Resume (PDF)",
 
236
 
237
  # Clean up the temporary directory
238
  os.remove(output_path)
239
+
240
+
241
+ def display_content_with_page_numbers(content, words_per_page=500):
242
+ # Split content into words
243
+ words = content.split()
244
+ total_pages = (len(words) // words_per_page) + (1 if len(words) % words_per_page != 0 else 0)
245
+
246
+ # Display content with page numbers
247
+ for i in range(total_pages):
248
+ start_index = i * words_per_page
249
+ end_index = start_index + words_per_page
250
+ page_content = ' '.join(words[start_index:end_index])
251
+
252
+ st.markdown(f"### Page {i + 1}")
253
+ st.write(page_content)
254
+
255
  def save_docx_as_pdf(input_path, output_path='output.pdf'):
256
  if input_path.lower().endswith('.docx'):
257
  try:
 
635
  st.markdown("### Tailored Resume:")
636
  # display_doc_as_image2(gen_pdf_path)
637
  # display_pdf_pages_as_images(gen_pdf_path)
638
+ # st.write(generated_resume)
639
+ display_content_with_page_numbers(generated_resume, 290)
640
  st.success(f"Download tailored resume")
641
  st.download_button(
642
  label="Generated Resume (PDF)",