pktpaulie commited on
Commit
68367e2
·
verified ·
1 Parent(s): c8c5063

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -326,7 +326,19 @@ def display_pdf_page1(pdf_path):
326
  display(img)
327
  except Exception as e:
328
  st.error(f"Failed to display image: {str(e)}")
329
-
 
 
 
 
 
 
 
 
 
 
 
 
330
  def display_pdf_page(pdf_path, page_number=1):
331
  with open(pdf_path, 'rb') as file:
332
  reader = PyPDF2.PdfReader(file)
@@ -510,13 +522,14 @@ if uploaded_resume and uploaded_job_description:
510
  # Generate Tailored Resume Section
511
  st.markdown("---")
512
  # st.subheader("Tailor Resume")
513
-
514
- iframe_code = f"""
515
- <iframe src="{resume_path}" width="100%" height="600px"></iframe>
516
- """
517
- st.markdown(iframe_code, unsafe_allow_html=True)
518
 
519
- st.components.v1.iframe(resume_path, width=800, height=600)
 
 
 
 
 
 
520
 
521
 
522
  if st.button("Tailor Resume"):
 
326
  display(img)
327
  except Exception as e:
328
  st.error(f"Failed to display image: {str(e)}")
329
+
330
+ def display_pdf_pages_as_images(pdf_path):
331
+ try:
332
+ with pdfplumber.open(pdf_path) as pdf:
333
+ for i, page in enumerate(pdf.pages):
334
+ st.markdown(f"### Page {i + 1}")
335
+ # Convert the page to an image
336
+ image = page.to_image()
337
+ # Render the image using Streamlit
338
+ st.image(image.original, use_column_width=True)
339
+ except Exception as e:
340
+ st.error(f"Failed to display PDF as image: {str(e)}")
341
+
342
  def display_pdf_page(pdf_path, page_number=1):
343
  with open(pdf_path, 'rb') as file:
344
  reader = PyPDF2.PdfReader(file)
 
522
  # Generate Tailored Resume Section
523
  st.markdown("---")
524
  # st.subheader("Tailor Resume")
 
 
 
 
 
525
 
526
+ display_pdf_pages_as_images(resume_path)
527
+ # iframe_code = f"""
528
+ # <iframe src="{resume_path}" width="100%" height="600px"></iframe>
529
+ # """
530
+ # st.markdown(iframe_code, unsafe_allow_html=True)
531
+
532
+ # st.components.v1.iframe(resume_path, width=800, height=600)
533
 
534
 
535
  if st.button("Tailor Resume"):