A comprehensive Flask-based safety application featuring AI assistance, safe route planning, instant SOS alerts, incident reporting, and anonymous community support. The application runs locally with HTTPS to enable secure browser permissions for location, microphone, camera, and notifications.
- One-tap emergency alerts with live GPS tracking
- Automatic SMS notifications to emergency contacts
- WhatsApp alert integration with tracking links
- Voice and video recording during emergencies
- Real-time location broadcasting every 60 seconds
- AI-powered route optimization based on crime density, street lighting, and population data
- Interactive map with safety scores
- Multiple route options with detailed safety metrics
- Step-by-step guided questionnaire
- AI-generated professional summaries using Google Gemini
- Evidence upload support for photos, audio, video, and documents
- Anonymous or identified reporting options
- Export functionality for official documentation
- Anonymous story sharing platform
- Peer support with reactions and comments
- AI-powered emotional support chat
- Safe space for sharing experiences
- AI-powered conversational fake calls using Google Gemini
- Voice recognition for natural responses
- Discreet escape from dangerous situations
- Customizable caller names
- HTTPS encryption with self-signed certificate for local development
- Anonymous posting options
- Secure data storage
- User consent controls for data sharing
- Python 3.8 or higher
- pip package manager
- Clone the repository:
git clone https://github.com/abhiraamadiga/women-safety-app.git
cd women-safety-app\women-safety-app- Create and activate virtual environment:
python -m venv .venv
& .\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip- Install dependencies:
pip install -r requirements.txt- Configure environment variables by creating a
.envfile:
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash
GEMINI_API_VERSION=v1
# Optional SMS providers
FAST2SMS_API_KEY=your_fast2sms_key_here
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
SECRET_KEY=your-secret-key-hereObtain a Gemini API key from Google AI Studio.
- Generate SSL certificate (if not present):
python generate_cert.py- Start the server:
python app.py --https --https-port 5443- Access the application at
https://127.0.0.1:5443and accept the security warning for the self-signed certificate.
To access from a mobile device on the same WiFi network:
- Find your computer's IP address:
ipconfig- Visit
https://YOUR_IP:5443on your mobile browser and accept the certificate warning.
# Check server health
curl.exe -k https://127.0.0.1:5443/api/health
# Verify AI integration
curl.exe -k https://127.0.0.1:5443/api/ai-statuswomen-safety-app/
├── app/
│ ├── __init__.py
│ ├── routes.py
│ ├── models.py
│ ├── auth_models.py
│ ├── route_optimizer.py
│ ├── data/
│ │ ├── bangalore_crimes.csv
│ │ ├── bangalore_lighting.csv
│ │ └── bangalore_population.csv
│ ├── templates/
│ ├── static/
│ └── uploads/
├── app.py
├── config.py
├── generate_cert.py
├── requirements.txt
└── instance/
- Navigate to
https://127.0.0.1:5443 - Create an account with email, phone, and password
- Complete optional profile information for enhanced safety features
- Grant browser permissions for location, notifications, microphone, and camera
- Access the SOS Center from the main navigation
- Add emergency contacts with names and phone numbers
- Activate SOS with a single tap when in danger
- System automatically:
- Sends SMS alerts to all emergency contacts
- Broadcasts live GPS location every 60 seconds
- Provides WhatsApp sharing options
- Records audio/video if enabled
- Deactivate SOS when safe
- Navigate to Safe Routes section
- Enter your starting location and destination
- View multiple route options with safety scores based on:
- Crime density data
- Street lighting coverage
- Population density
- Select preferred route and view on interactive map
- Provide feedback on route safety after use
- Access Incident Report from the main menu
- Complete the guided questionnaire:
- Incident type and category
- Location and date/time details
- Involved parties information
- Impact assessment
- Additional context
- Upload supporting evidence (photos, audio, video, documents)
- Generate AI-powered professional summary
- Choose to report anonymously or with identification
- Export report as PDF for official use
- Visit the Community Support section
- Share your story anonymously or with username
- Read and react to other community posts
- Add supportive comments to help others
- Access AI-powered emotional support chat for immediate assistance
- Navigate to Fake Call section
- Configure caller name and relationship
- Activate fake call when needed
- Engage in AI-powered natural conversation
- Use as a discreet exit strategy from uncomfortable situations
- Go to Emergency Contacts in settings
- Add contact name and phone number
- Verify contact information
- Edit or remove contacts as needed
- Contacts receive automatic alerts during SOS activation
- Access Settings from user menu
- Update personal information and profile photo
- Configure anonymity preferences for community posts
- Manage data sharing consent for authorities
- Set data retention preferences
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: 911