Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -327,27 +327,30 @@ def display_doc_as_image2(pdf_path):
|
|
327 |
# display(Image(filename=images[0].filename))
|
328 |
# except Exception as e:
|
329 |
# st.error(f"Failed to display image: {str(e)}")
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
|
347 |
-
|
348 |
-
|
349 |
-
except Exception as e:
|
350 |
-
|
351 |
|
352 |
def display_doc_as_image3(pdf_path):
|
353 |
try:
|
@@ -367,12 +370,13 @@ def display_doc_as_image3(pdf_path):
|
|
367 |
# except Exception as e:
|
368 |
# st.error(f"Failed to display image: {str(e)}")
|
369 |
|
370 |
-
def display_doc_as_image1(
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
|
|
376 |
|
377 |
|
378 |
def display_doc_as_image(file_path):
|
@@ -533,10 +537,10 @@ if uploaded_resume and uploaded_job_description:
|
|
533 |
with col1:
|
534 |
st.markdown("### Uploaded Resume:")
|
535 |
save_docx_as_pdf(resume_path, '/tmp/uploaded_resume.pdf')
|
536 |
-
|
537 |
with col2:
|
538 |
st.markdown("### Tailored Resume:")
|
539 |
-
|
540 |
# from io import BytesIO
|
541 |
# doc = Document()
|
542 |
|
|
|
327 |
# display(Image(filename=images[0].filename))
|
328 |
# except Exception as e:
|
329 |
# st.error(f"Failed to display image: {str(e)}")
|
330 |
+
|
331 |
+
<iframe src=pdf_path width="100%" height="600px"></iframe>
|
332 |
+
|
333 |
+
# try:
|
334 |
+
# # Convert PDF to images
|
335 |
+
# images = []
|
336 |
+
# for i in range(1): # Assuming only one page
|
337 |
+
# command = [
|
338 |
+
# "pdf2image", "-j", "--png",
|
339 |
+
# "-f", str(i+1),
|
340 |
+
# "-l", str(i+1),
|
341 |
+
# pdf_path
|
342 |
+
# ]
|
343 |
+
# output = subprocess.check_output(command)
|
344 |
|
345 |
+
# # Decode the base64 image data
|
346 |
+
# img_data = base64.b64decode(output.split()[0])
|
347 |
+
# img = Image.open(BytesIO(img_data))
|
348 |
+
# images.append(img)
|
349 |
|
350 |
+
# # Display the first page
|
351 |
+
# display(images[0])
|
352 |
+
# except Exception as e:
|
353 |
+
# st.error(f"Failed to display image: {str(e)}")
|
354 |
|
355 |
def display_doc_as_image3(pdf_path):
|
356 |
try:
|
|
|
370 |
# except Exception as e:
|
371 |
# st.error(f"Failed to display image: {str(e)}")
|
372 |
|
373 |
+
def display_doc_as_image1(pdf_url):
|
374 |
+
st.components.v1.iframe(pdf_url, width=800, height=600)
|
375 |
+
# try:
|
376 |
+
# img = Image.open(pdf_path)
|
377 |
+
# st.image(img)
|
378 |
+
# except Exception as e:
|
379 |
+
# st.error(f"Failed to display image: {str(e)}")
|
380 |
|
381 |
|
382 |
def display_doc_as_image(file_path):
|
|
|
537 |
with col1:
|
538 |
st.markdown("### Uploaded Resume:")
|
539 |
save_docx_as_pdf(resume_path, '/tmp/uploaded_resume.pdf')
|
540 |
+
display_doc_as_image1('/tmp/uploaded_resume.pdf')
|
541 |
with col2:
|
542 |
st.markdown("### Tailored Resume:")
|
543 |
+
display_doc_as_image2(gen_pdf_path)
|
544 |
# from io import BytesIO
|
545 |
# doc = Document()
|
546 |
|