A real-time voice emergency detection system that uses advanced voice processing to identify emergency situations and provide appropriate responses.
- Real-time voice recording and processing
- Emergency classification based on keywords (Fire, Medical, Violence, Accident)
- Text-to-speech response generation using ElevenLabs
- Persistent event storage with MongoDB
- Real-time event feed via WebSocket
- Responsive web interface built with React
- Python 3.8+
- Node.js 14+
- MongoDB Atlas account
- ElevenLabs API key
-
Navigate to the backend directory:
cd backend -
Install Python dependencies:
pip install -r requirements.txt
-
Configure environment variables in
.env:MONGO_URL="your_mongodb_connection_string" DB_NAME="voice_assistant_db" CORS_ORIGINS="*" -
Start the backend server:
uvicorn server:app --host 0.0.0.0 --port 8000 --reload
-
Navigate to the frontend directory:
cd frontend -
Install Node dependencies:
yarn install
-
Configure environment variables in
.env:REACT_APP_BACKEND_URL=http://localhost:8000 -
Start the development server:
yarn start
This application is configured for deployment to:
- Frontend: Vercel (free tier)
- Backend: Render (free tier)
📖 Complete deployment guide: See DEPLOYMENT.md for detailed step-by-step instructions.
Copy .env.example files and update with your credentials:
Backend (backend/.env):
MONGO_URL=your_mongodb_connection_string
DB_NAME=voice_assistant_db
ELEVENLABS_API_KEY=your_elevenlabs_api_key
GEMINI_API_KEY=your_gemini_api_key
CORS_ORIGINS=*Frontend (frontend/.env):
REACT_APP_BACKEND_URL=http://localhost:8000Run the deployment script:
./deploy.shThis will:
- Install all dependencies
- Build production versions of both frontend and backend
- Start both services in the background
- Log output to the
logs/directory
- Open your browser and navigate to
http://localhost:3000 - Click the microphone button to start recording
- Speak an emergency phrase (e.g., "There's a fire in the building")
- View the classified emergency and AI response
- Monitor real-time events in the event feed
POST /api/voice- Process voice recording- Form data:
audio(webm audio file) - Returns: Emergency event object
- Form data:
GET /api/events- Get recent emergency events- Query param:
limit(default: 50) - Returns: List of events
- Query param:
GET /api/status- Get system status checksPOST /api/status- Create new status check
WS /ws- Real-time event streaming
┌─────────────┐ HTTP ┌──────────────┐
│ React │ ──────────▶│ FastAPI │
│ Frontend │ │ Backend │
└─────────────┘ └──────────────┘
│
┌────▼────┐
│ MongoDB │
│ Atlas │
└─────────┘
- ElevenLabs STT: Speech-to-text conversion with fallback to mock STT
- Keyword Classifier: Classifies emergencies based on transcript keywords
- ElevenLabs TTS: Text-to-speech response generation
- MongoDB Event Store: Persistent storage of emergency events
- WebSocket Manager: Real-time event broadcasting
backend/
├── routes/ # API route handlers
├── services/ # Business logic and external services
├── websocket/ # WebSocket connection management
├── server.py # Main application entry point
└── requirements.txt # Python dependencies
frontend/
├── src/
│ ├── components/ # React UI components
│ ├── pages/ # Page components
│ ├── services/ # API service clients
│ └── App.js # Main application component
└── package.json # Node dependencies
This project is proprietary and confidential.