Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import pdfplumber
|
| 2 |
from transformers import LayoutLMv2Processor, LayoutLMv2ForTokenClassification
|
| 3 |
import torch
|
|
@@ -49,11 +50,14 @@ def process_pdfs(pdf1, pdf2):
|
|
| 49 |
except Exception as e:
|
| 50 |
return f"Error processing PDFs: {e}"
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
pdf2_path = "path/to/target.pdf" # Placeholder path
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
import pdfplumber
|
| 3 |
from transformers import LayoutLMv2Processor, LayoutLMv2ForTokenClassification
|
| 4 |
import torch
|
|
|
|
| 50 |
except Exception as e:
|
| 51 |
return f"Error processing PDFs: {e}"
|
| 52 |
|
| 53 |
+
# Streamlit UI
|
| 54 |
+
st.title("PDF Comparison Tool")
|
| 55 |
+
st.write("Upload two PDFs to compare their content. The first PDF is treated as the source of truth.")
|
|
|
|
| 56 |
|
| 57 |
+
pdf1 = st.file_uploader("Upload Source PDF (A)", type=["pdf"])
|
| 58 |
+
pdf2 = st.file_uploader("Upload Target PDF (B)", type=["pdf"])
|
| 59 |
+
|
| 60 |
+
if pdf1 and pdf2:
|
| 61 |
+
with st.spinner("Processing..."):
|
| 62 |
+
result = process_pdfs(pdf1, pdf2)
|
| 63 |
+
st.text_area("Comparison Result", result, height=400)
|