pktpaulie commited on
Commit
1865a58
·
verified ·
1 Parent(s): 599ea63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -368,18 +368,18 @@ def display_doc_as_image(file_path):
368
  st.error(f"Final fallback failed: {str(final_error)}")
369
 
370
 
371
- # def display_doc_as_image1(pdf_path):
372
- # # poppler_path = 'usr/bin'
373
- # # images = convert_from_path(pdf_path, poppler_path=poppler_path)
374
- # # for img in images:
375
- # # buf = BytesIO()
376
- # # img.save(buf, format="PNG")
377
- # # st.image(buf)
378
 
379
- # from IPython.display import display, Image
380
 
381
- # images = convert_from_bytes(open(pdf_path, 'rb').read(), size=800)
382
- # display(images[0])
383
 
384
  # Process if files are uploaded
385
  if uploaded_resume and uploaded_job_description:
@@ -461,10 +461,10 @@ if uploaded_resume and uploaded_job_description:
461
  with col1:
462
  st.markdown("### Uploaded Resume:")
463
  save_docx_as_pdf(resume_path, '/tmp/uploaded_resume.pdf')
464
- display_doc_as_image1('/tmp/uploaded_resume.pdf')
465
  with col2:
466
  st.markdown("### Tailored Resume:")
467
- display_doc_as_image(gen_pdf_path)
468
  # from io import BytesIO
469
  # doc = Document()
470
 
 
368
  st.error(f"Final fallback failed: {str(final_error)}")
369
 
370
 
371
+ def display_doc_as_image5(pdf_path):
372
+ poppler_path = 'usr/bin'
373
+ images = convert_from_path(pdf_path, poppler_path=poppler_path)
374
+ for img in images:
375
+ buf = BytesIO()
376
+ img.save(buf, format="PNG")
377
+ st.image(buf)
378
 
379
+ # from IPython.display import display, Image
380
 
381
+ # images = convert_from_bytes(open(pdf_path, 'rb').read(), size=800)
382
+ # display(images[0])
383
 
384
  # Process if files are uploaded
385
  if uploaded_resume and uploaded_job_description:
 
461
  with col1:
462
  st.markdown("### Uploaded Resume:")
463
  save_docx_as_pdf(resume_path, '/tmp/uploaded_resume.pdf')
464
+ display_doc_as_image2('/tmp/uploaded_resume.pdf')
465
  with col2:
466
  st.markdown("### Tailored Resume:")
467
+ display_doc_as_image5(gen_pdf_path)
468
  # from io import BytesIO
469
  # doc = Document()
470