fizzarif7 commited on
Commit
67e1abc
Β·
verified Β·
1 Parent(s): a33168f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -129,8 +129,6 @@ def verify_text(text, source_type="TEXT"):
129
  return report
130
 
131
  def verify_document(file):
132
- if file is None:
133
- return "❌ Please upload a file."
134
  file_path = file.name
135
  ext = file_path.split('.')[-1].lower()
136
  if ext == "pdf":
@@ -149,15 +147,22 @@ def verify_document(file):
149
  st.set_page_config(page_title="πŸ“‘ Document Authenticity Verifier", layout="wide")
150
 
151
  st.title("πŸ“‘ Document Authenticity Verifier")
152
- st.write("Upload a **PDF, DOCX, or Image** to verify authenticity.")
153
 
 
154
  uploaded_file = st.file_uploader("Upload Document", type=["pdf", "docx", "png", "jpg", "jpeg"])
155
 
 
 
 
156
  if st.button("Verify Document"):
157
  if uploaded_file is not None:
158
  with open(uploaded_file.name, "wb") as f:
159
  f.write(uploaded_file.getbuffer())
160
  report = verify_document(uploaded_file)
161
  st.text_area("Verification Report", report, height=400)
 
 
 
162
  else:
163
- st.warning("Please upload a document first.")
 
129
  return report
130
 
131
  def verify_document(file):
 
 
132
  file_path = file.name
133
  ext = file_path.split('.')[-1].lower()
134
  if ext == "pdf":
 
147
  st.set_page_config(page_title="πŸ“‘ Document Authenticity Verifier", layout="wide")
148
 
149
  st.title("πŸ“‘ Document Authenticity Verifier")
150
+ st.write("Upload a **PDF, DOCX, or Image**, OR paste raw **text** to verify authenticity.")
151
 
152
+ # File uploader
153
  uploaded_file = st.file_uploader("Upload Document", type=["pdf", "docx", "png", "jpg", "jpeg"])
154
 
155
+ # Text input
156
+ manual_text = st.text_area("Or paste the notification text here:")
157
+
158
  if st.button("Verify Document"):
159
  if uploaded_file is not None:
160
  with open(uploaded_file.name, "wb") as f:
161
  f.write(uploaded_file.getbuffer())
162
  report = verify_document(uploaded_file)
163
  st.text_area("Verification Report", report, height=400)
164
+ elif manual_text.strip():
165
+ report = verify_text(manual_text, source_type="MANUAL TEXT")
166
+ st.text_area("Verification Report", report, height=400)
167
  else:
168
+ st.warning("Please upload a document or paste text first.")