Gringotts is a comprehensive Flask-based safety application with AI assistance, safe route planning, instant SOS alerts, incident reporting, and an anonymous community support wall. It runs locally with HTTPS to enable secure browser permissions (location, microphone, camera, notifications).
- One-tap emergency alerts with live GPS tracking
- Automatic SMS notifications to emergency contacts
- WhatsApp alert integration with tracking links
- Voice/video recording during emergencies
- Real-time location broadcasting every 60 seconds
- AI-powered route optimization based on:
- Crime density analysis (260 crime records)
- Street lighting coverage (1,144 lighting points)
- Population density (187 data points)
- Interactive map with safety scores
- Multiple route options with detailed metrics
- Step-by-step guided questionnaire
- AI-generated professional summaries (Gemini)
- Evidence upload (photos, audio, video, documents)
- Anonymous or identified reporting options
- Export reports for official documentation
- Anonymous story sharing
- Peer support with reactions and comments
- AI-powered emotional support chat
- Safe space for sharing experiences
- AI-powered conversational fake calls (Gemini)
- Voice recognition for natural responses
- Escape dangerous situations discreetly
- Customizable caller names
- HTTPS encryption (self-signed certificate for local dev)
- Anonymous posting options
- Secure data storage
- No personal data exposure without consent
# Clone from GitHub
git clone https://github.com/abhiraamadiga/women-safety-app.git
cd women-safety-app\women-safety-app# Create a new virtual environment
python -m venv .venv
# Activate the virtual environment
& .\.venv\Scripts\Activate.ps1
# Upgrade pip
python -m pip install --upgrade pip# Install all required packages
pip install -r requirements.txtRequired packages will be installed:
- Flask (web framework)
- Flask-SQLAlchemy (database ORM)
- Flask-CORS (cross-origin requests)
- pandas & numpy (data analysis for safe routes)
- requests (API calls to Gemini, SMS providers)
- python-dotenv (environment variable management)
- werkzeug (file uploads & security)
- gevent (HTTPS server support)
Create a file named .env in the women-safety-app folder:
# ===== REQUIRED: Google Gemini AI =====
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash
GEMINI_API_VERSION=v1
# ===== OPTIONAL: SMS Providers (for automatic SOS alerts) =====
# Fast2SMS (Indian SMS service - requires 10-digit numbers)
FAST2SMS_API_KEY=your_fast2sms_key_here
# OR Twilio (International SMS - requires E.164 format: +919876543210)
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_twilio_auth_token_here
# ===== Flask Configuration =====
SECRET_KEY=change-this-to-a-random-secret-key-in-productionπ Get Your Gemini API Key:
- Visit Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and paste it in
.env
The app needs HTTPS for browser permissions. Generate a self-signed certificate:
# The cert.pem and key.pem files should already be in the repo
# If missing, you can generate them:
# pip install pyopenssl
# python -c "from OpenSSL import crypto; k = crypto.PKey(); k.generate_key(crypto.TYPE_RSA, 2048); c = crypto.X509(); c.get_subject().CN = 'localhost'; c.set_serial_number(1000); c.gmtime_adj_notBefore(0); c.gmtime_adj_notAfter(365*24*60*60); c.set_issuer(c.get_subject()); c.set_pubkey(k); c.sign(k, 'sha256'); open('cert.pem', 'wb').write(crypto.dump_certificate(crypto.FILETYPE_PEM, c)); open('key.pem', 'wb').write(crypto.dump_privatekey(crypto.FILETYPE_PEM, k))"# Make sure virtual environment is activated
& .\.venv\Scripts\Activate.ps1
# Start HTTPS server on port 5443
python app.py --https --https-port 5443You should see:
============================================================
π Women's Safety App - FULL APPLICATION
============================================================
π Crime data: 260 records
π‘ Lighting data: 1144 points
π₯ Population data: 187 points
...
π Starting HTTPS server
URL : https://127.0.0.1:5443
- Open your browser and go to: https://127.0.0.1:5443
- You'll see a security warning (normal for self-signed certificates)
- Click "Advanced" β "Proceed to 127.0.0.1 (unsafe)" or similar
- The onboarding screen will appear requesting permissions
- Grant permissions for full functionality
# Check server health
curl.exe -k https://127.0.0.1:5443/api/health
# Check Gemini AI status
curl.exe -k https://127.0.0.1:5443/api/ai-statusTo test on your phone (same WiFi network):
- Find your PC's IP address:
ipconfig
# Look for "IPv4 Address" under your active network adapter
# Example: 192.168.1.100-
On your phone, visit:
https://YOUR_IP:5443- Example:
https://192.168.1.100:5443
- Example:
-
Accept the certificate warning on mobile browser
-
Grant permissions when the onboarding modal appears
women-safety-app/
βββ app/
β βββ __init__.py # Flask app factory
β βββ routes.py # All routes (SOS, Chat, Safe Routes, etc.)
β βββ templates/
β β βββ base.html
β β βββ incident_report.html
β β βββ report_summary.html
β β βββ community_support.html
β βββ static/
β β βββ css/style.css
β β βββ js/dynamic_form.js
β βββ uploads/evidence/ # File upload directory
βββ app.py # Application entry point
βββ config.py # Configuration
βββ requirements.txt # Python dependencies
- Visit http://127.0.0.1:5000
- Answer the multi-step questionnaire:
- Who was involved?
- What type of incident?
- Where did it happen?
- Impact on you
- Date and time
- First occurrence?
- Optionally upload evidence files
- Click "Generate Report"
- The Gemini AI will create a professional summary
- Takes 5-10 seconds to generate
- Summary is empathetic and factual
- Chat: visit /support-chat or start AI Fake Call at /fake-call
- Post your summary to the community wall
- Remain completely anonymous
- Receive support from others
- View other anonymous stories
- Send support with hearts β€οΈ
- Add supportive comments
- All interactions are anonymous
Gemini configuration is read from environment variables via .env (no keys in code). See Quick Start step 2.
- Move API key to environment variables
- Use HTTPS
- Add rate limiting
- Implement proper database storage
- Add user authentication (if needed)
- Change SECRET_KEY in config
# Common fixes
# 1) Ensure venv is activated and deps are installed
& .\.venv\Scripts\Activate.ps1; pip install -r requirements.txt
# 2) If port 5443 in use, kill previous Python processes
Get-Process -Name python -ErrorAction SilentlyContinue | Stop-Process- Verify GEMINI_API_KEY is set and valid
- Ensure
.envis in thewomen-safety-appfolder - Confirm model/version:
GEMINI_MODEL=gemini-2.0-flash,GEMINI_API_VERSION=v1
- Ensure
app/uploads/evidence/directory exists - Check file size (max 16MB)
- Allowed formats: png, jpg, jpeg, gif, mp3, wav, m4a, mp4, mov, pdf
Press Ctrl+C in the terminal running the Flask app.
- Add database integration (SQLite/PostgreSQL)
- Implement persistent storage for posts
- Add export to PDF feature
- Implement search/filter on community wall
- Add email notifications (optional)
- Deploy to cloud platform
The SOS Center can notify your emergency contacts immediately:
- WhatsApp: On SOS activation, a modal opens with a Share button (choose multiple recipients) and per-contact WhatsApp buttons. This requires you to tap to send (WhatsApp does not allow fully automatic sending without the Business API).
- SMS: The server can send real SMS automatically using Fast2SMS or Twilio if configured. If not configured, it logs a mock send to
app/uploads/sos/logs/sms_log.json.
Enable real SMS via Twilio (Windows PowerShell):
$env:TWILIO_ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$env:TWILIO_AUTH_TOKEN = "your_auth_token"
$env:TWILIO_FROM_NUMBER = "+1XXXXXXXXXX" # Your Twilio SMS-enabled number in E.164 formatThen install dependencies and run the app:
cd "c:\Users\abhi1\OneDrive\Desktop\women-safety\women-safety-app"
..\.venv\Scripts\python.exe -m pip install -r requirements.txt
..\.venv\Scripts\python.exe app.pyNotes:
- For Twilio, store contact numbers in E.164 (e.g., +9198XXXXXXXX). For Fast2SMS, store 10-digit Indian numbers.
- If provider calls fail, the app still logs the message and shows it in the console and
sms_log.jsonso you can send manually. - WhatsApp Business Cloud API requires Facebook Business verification and approved templates; not enabled by default in this project.
- National Helpline: 123-456
- Local Support Center: 987-654
- Emergency Services: 112
Built with: Flask, Bootstrap, Leaflet, Gemini AI License: MIT Last Updated: November 2, 2025