-
-
Either copy paste your scam message or upload your pdf or screenshot. For demonstration you can try out the demo examples given there
-
It will showcase the risk(High or Low) and which type of scam
-
will tell which words flagged it (you can share this and also can hear it)
-
Tells us about the necessary steps to take
Inspiration
Scam messages that impersonate law enforcement, tax authorities, courts and banks, such as bogus "digital arrest" warrants, account-freeze threats and fake departmental notices, rely on manufactured urgency and intimidation. They are designed to force panic before a victim can pause or ask for advice.
We built RedFlagged to give people that pause. Instead of relying on a free-form chatbot that may produce unsupported conclusions, RedFlagged runs a dedicated verification workflow: paste a message, upload a screenshot, or upload a notice PDF, and see why it looks suspicious, with the evidence shown, before any money or data is handed over.
What it does
RedFlagged turns a suspicious message into a structured risk breakdown:
- Text extraction from text, images and PDFs: PDF text is read with pypdf (all pages) and images are transcribed with Gemini vision. The extracted text appears in an editable box, so users can correct it before analysis.
- Deterministic rule engine: Six rule checks cover urgency or coercion, payment demands (including UPI handles and apps such as GPay and PhonePe), OTP/Aadhaar/credential requests, courier and customs-fee scams, job and internship fee lures, and suspicious links. Link checks cover raw IP hosts, URL shorteners, high-abuse TLDs, deceptive subdomains and lookalike domains (Levenshtein distance). Negated statements such as "the bank never asks for your OTP" do not trigger rules.
- Transparent scoring: Triggered rule weights are combined with a saturating curve, score = round(100 × (1 − e^(−raw points / 38))). The risk level comes from the same score: below 25 is LOW, 25 to 64 is MEDIUM, 65 and above is HIGH. Gemini explains the result but never changes the score or the level.
- Curated institutional context: A small knowledge base of verification guidance (government and tax notices, police and courts, banking) is matched to the message and passed to the AI.
- Plain-language explanation and safe steps: Gemini returns a structured summary, red flags with evidence, recommended safe steps and verification guidance, rather than a "real or fake" verdict. Reports point users to the National Cyber Crime helpline (1930) and cybercrime.gov.in.
- English and Hindi: Hindi (Devanagari) messages get Hindi results. Roman-script Hindi is detected by the rules, but its explanation is in English.
- Backup mode: If the Gemini call fails, the app still returns the rule-based score, flags, evidence and fixed safety steps instead of an error.
- Sharing and accessibility: Results can be copied for WhatsApp or SMS, exported to PDF, and read aloud using the browser's speech synthesis (a Hindi voice must be installed on the device for Hindi).
RedFlagged does not decide whether a message or document is legally genuine, and it is not legal advice.
How we built it
- Frontend: React, Vite and Tailwind CSS with Lucide icons, hosted on Vercel.
- Backend: Python with FastAPI and Uvicorn, hosted on Render.
- Text extraction: pypdf for PDFs and the Google Gemini API (vision) for images, which replaced an earlier Tesseract OCR approach.
- Rule engine (
rules.py): Pure Python with English and Devanagari-aware regular expressions, clause-limited negation handling and URL/domain checks. - Knowledge base (
knowledge.py): Curated guidance entries retrieved by keyword match. - Reasoning layer: Google Gemini API (gemini-2.5-flash by default) with a strict JSON response schema via google-genai.
- AI tooling disclosure: AI coding assistants (Claude, ChatGPT, Cursor) were used for boilerplate generation, regex optimization and deployment debugging.
Challenges we ran into
- A deployment crash that looked like a CORS error: Tesseract OCR is a system binary that was not available in the Render environment. The failure produced no response headers, so the browser reported a CORS-style error. We moved image transcription to Gemini vision, which removed the native dependency.
- Linear scoring inflates scores: Adding rule weights directly makes scores climb without limit as flags stack up. A saturating exponential curve keeps scores on a stable 0 to 100 scale, with the risk level derived from the same number.
- False positives on benign messages: Early keyword matching flagged statements like "there is no urgent deadline." We added negation-aware matching and tightened the AI instructions so that well-known domains are not treated as suspicious without other evidence.
- Hindi matching: Python's
\bword boundary does not work with Devanagari vowel signs, so several Hindi rules silently never matched. We replaced it with explicit look-arounds and merged three overlapping negation checks into one clause-limited check. - Never failing on the user: Free-tier Gemini quotas can run out, so we built backup mode, which returns an HTTP 200 response from the rule engine so the frontend never receives an error.
Accomplishments that we're proud of
- A hybrid pipeline where deterministic rules and curated guidance decide the score, and the AI focuses on explaining it in plain language.
- A regression script of 30 invented messages (Hindi, Hinglish and English scams, genuine notices and everyday chat) that all pass, plus 9 pytest cases for rule scores and URL checks.
- Fee-based job scams written in Hindi now score HIGH (82/100) with a Hindi explanation.
- A safety-first design that guides users to official channels instead of acting as a legal authority.
These are observed test results, not a claim of exhaustive validation.
What we learned
- Reliable AI applications depend on what you delegate to deterministic code. Grounding the score in inspectable rules reduces unsupported claims.
- Enforcing a JSON schema on the model is more dependable than asking it to "respond only with valid JSON."
- In a Vercel + Render setup, an unhandled backend error can surface in the browser as a CORS failure, so returning a normal response from the backend matters.
What's next for RedFlagged
- Gujarati analysis and output, and better handling of Roman-script Hindi.
- A broader knowledge base covering financial fraud, phishing and fraudulent job or internship offers.
- A transparency panel showing triggered rule weights and the knowledge sources used.
- More benign, ambiguous and malicious test messages to measure false positives and false negatives.
