Spaces:
Build error
Build error
Commit ·
dbe5c4c
1
Parent(s): d947145
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,6 +53,14 @@ if pdf_file and docx_file:
|
|
| 53 |
pdf_text = read_pdf(pdf_file)
|
| 54 |
docx_text = read_docx(docx_file)
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
if pdf_text and docx_text:
|
| 57 |
comparison_result = compare_texts(pdf_text, docx_text)
|
| 58 |
st.text(comparison_result)
|
|
|
|
| 53 |
pdf_text = read_pdf(pdf_file)
|
| 54 |
docx_text = read_docx(docx_file)
|
| 55 |
|
| 56 |
+
b64_pdf = base64.b64encode(pdf_file.read()).decode() # some strings <-> bytes conversions necessary here
|
| 57 |
+
href = f'<a href="data:file/pdf;base64,{b64_pdf}" download="file.pdf">Download PDF File</a> (right-click and save as <some_name>.pdf)'
|
| 58 |
+
st.markdown(href, unsafe_allow_html=True)
|
| 59 |
+
|
| 60 |
+
st.markdown(f'<iframe src="data:application/pdf;base64,{b64_pdf}" width="50%" height="600px" type="application/pdf"></iframe>', unsafe_allow_html=True)
|
| 61 |
+
st.markdown("### DOCX Content:")
|
| 62 |
+
st.text(docx_text)
|
| 63 |
+
|
| 64 |
if pdf_text and docx_text:
|
| 65 |
comparison_result = compare_texts(pdf_text, docx_text)
|
| 66 |
st.text(comparison_result)
|