Spaces:
Sleeping
Sleeping
Update app.py
Browse files8 unmodified lines9101112131415123 unmodified lines13914014114214314414517 unmodified lines16316416516616716816 unmodified lines1851861871881891901918 unmodified lines# Configuration - Get API key from Streamlit secretsGEMINI_API_KEY = st.secrets["GEMINI_API_KEY"]GEMINI_MODEL = "gemini-2.0-flash"DOCUMENT_TYPES = ["Land Records", "Caste Certificates", "Property Registrations"]# Initialize session state (excluding widget-controlled keys)def initialize_session_state():123 unmodified linesdetails = query_gemini(extract_prompt, image_b64)# Verify authenticityverify_prompt = "Analyze this document for signs of tampering. Provide verification status."verification = query_gemini(verify_prompt, image_b64)st.session_state.processed_doc = {17 unmodified lines# Sidebar Controlswith st.sidebar:st.header("Document Controls")# The file uploader widget manages its own state with key "uploaded_file"st.file_uploader("Upload Document",16 unmodified lines# Main Interfacest.title("📄 Automated Document Verifier")if st.session_state.get("processed_doc") and st.session_state.get("doc_preview"):col1, col2 = st.columns([1, 2])with col1:st.subheader("Document Preview")8 unmodified lines9101112131415123 unmodified lines13914014114214314414517 unmodified lines16316416516616716816917017117217316 unmodified lines1901911921931941951968 unmodified lines# Configuration - Get API key from Streamlit secretsGEMINI_API_KEY = st.secrets["GEMINI_API_KEY"]GEMINI_MODEL = "gemini-2.0-flash"DOCUMENT_TYPES = ["Land Records", "Caste Certificates", "Property Registrations", "Others"]# Initialize session state (excluding widget-controlled keys)def initialize_session_state():123 unmodified linesdetails = query_gemini(extract_prompt, image_b64)# Verify authenticityverify_prompt = "Analyze this document for signs of tampering. Provide verification status in short (2 Lines)."verification = query_gemini(verify_prompt, image_b64)st.session_state.processed_doc = {17 unmodified lines# Sidebar Controlswith st.sidebar:st.header("Document Controls")# If a document preview exists, show it above the upload buttonif st.session_state.get("doc_preview"):st.subheader("Document Preview")st.image(st.session_state.doc_preview, use_column_width=True)# The file uploader widget manages its own state with key "uploaded_file"st.file_uploader("Upload Document",16 unmodified lines# Main Interfacest.title("📄 Automated Document Verifier")if st.session_state.get("processed_doc"):col1, col2 = st.columns([1, 2])with col1:st.subheader("Document Preview")
app.py+8-3