A full-stack Flask + React app that detects and redacts sensitive data (PII) from images before sending them to an AI model.
Built for hackathons and real-world privacy use-cases — your data is scrubbed before it reaches AI systems.
- 🧩 Text & Image Chat: Talk to the AI or send screenshots/documents.
- 🔍 Automatic PII Detection (OCR + Regex): Detects emails, phone numbers, and names.
- 🕵️ Selective Redaction: Choose what to hide before sending.
- 🧾 Simulated AI Mode: Works offline / without an API key (auto-switches when real key added).
- 💬 Local Chat History: Stored safely in your browser.
- 📤 Export Chat: One-click export as
.md. - 🧰 Clean UI: Fast, minimal React interface with banners and loading states.
| Layer | Tools |
|---|---|
| Frontend | React + Vite + Tailwind CSS |
| Backend | Flask (Python), Pillow, pytesseract |
| AI Integration | OpenAI GPT-4o (auto-fallback to simulation) |
| OCR Engine | Tesseract-OCR |
| Environment | Conda (Python) + npm (Node) |
git clone https://github.com/<your-username>/secure-ai-chat.git
cd secure-ai-chatcd server
conda create -n secure-ai-chat-backend python=3.11 -y
conda activate secure-ai-chat-backend
pip install -r requirements.txt- Download → https://github.com/UB-Mannheim/tesseract/wiki
- Confirm this path exists:
C:\Program Files\Tesseract-OCR\tesseract.exe- If installed elsewhere, update in server/main.py:
pytesseract.pytesseract.tesseract_cmd = r"<your-tesseract-path>"Create server/.env:
OPENAI_API_KEY=your-real-key-hereLeave blank → runs in simulated mode until real key available.
python main.pyFlask runs at 👉 http://127.0.0.1:8000
cd client
npm install
npm run devVite runs at 👉 http://localhost:5173
- Upload an image with text (e.g., ID card / document / screenshot).
- Backend extracts text using Tesseract OCR.
- Regex detects emails, phones, names, etc.
- You select which items to redact.
- Redacted image (black boxes) is generated locally.
- Sent to AI (simulated until real key available).
- AI replies while keeping your data private.
- 👤 You: “This is Secure AI Chat, a privacy-first assistant that detects and redacts sensitive info before processing.”
- 1️⃣ Upload an image → see detected PII on the right.
- 2️⃣ Select items → click Redact & Send.
- 3️⃣ Show the black-boxed redacted preview.
- 4️⃣ Explain: “This ensures no private data ever reaches the AI.”
- 5️⃣ Send a text → see simulated AI reply.
“When the official API key is added, the same workflow runs with GPT-4o — keeping privacy fully intact.”
secure-ai-chat/
│
├── client/ # React frontend
│ ├── src/
│ │ ├── App.jsx
│ │ ├── components/
│ │ ├── api.js
│ │ └── index.css
│ └── package.json
│
├── server/ # Flask backend
│ ├── main.py
│ ├── requirements.txt
│ └── .env
│
└── README.md- Real-time highlighting of PII on image preview
- Support for IBAN / credit card / address detection
- Docker + CI/CD deployment
- End-to-end upload encryption
- Goal: Build a secure AI chat system where data is sanitized before AI processing.
- Deliverables: Full stack prototype + README + Demo.
- Impact: Privacy-first AI — preventing accidental data leaks and enabling ethical AI use.
git add .
git commit -m "Final hackathon submission: Secure AI Chat"
git push origin main💬 GitHub Repo Description: Privacy-first AI assistant that detects and redacts sensitive data before sending to GPT-4o (Flask + React + Tesseract-OCR).
🔥 Hackathon Project: Secure AI Chat 🏆 Empowering safe and private AI interactions