Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
|
379 |
-
#
|
380 |
|
381 |
-
#
|
382 |
-
#
|
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 |
-
|
465 |
with col2:
|
466 |
st.markdown("### Tailored Resume:")
|
467 |
-
|
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 |
|