Your AI Partner in Moments that Matter โก
Sahaaya is an AI-powered Emergency Aid Companion that provides real-time, step-by-step first-aid guidance through voice and text input. Built for hackathons with a focus on accessibility, offline functionality, and life-saving emergency response.
ff7b49897fe1410ab38275b714519666.mp4
- ๐ค Smart Emergency Detection: AI-powered intent recognition that identifies emergency types from natural language
- ๐ฃ๏ธ Voice Input: Speak your emergency situation naturally - no need to memorize commands
- ๐ Text-to-Speech: Every instruction is read aloud with calm, clear voice guidance
- ๐ Step-by-Step Guidance: Structured, medical-grade first-aid instructions with timing and warnings
- โจ Glassmorphism UI: Beautiful, modern interface with blur effects and smooth animations
- โฟ Accessibility Features: High contrast mode, large text options, and screen reader support
- ๐ต Calm Design: Soothing colors and animations to reduce panic in emergency situations
- Fork this repository to your GitHub account
- Visit Streamlit Cloud
- Deploy directly from your forked repository
- Share your app with the world! ๐
# Clone the repository
git clone https://github.com/your-username/sahaaya.git
cd sahaaya
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.pyThe app will open at http://localhost:8501 ๐
# User describes emergency
user_input = "Someone collapsed and is not breathing"
# AI analyzes and detects emergency type
emergency_match = detector.detect_emergency(user_input)
# Result: Cardiac Arrest (95% confidence){
"step": 1,
"title": "Check Responsiveness",
"instruction": "Shake the person gently and shout 'Are you okay?'",
"duration": "10 seconds",
"warning": "Do not shake if you suspect spinal injury"
}- Speech-to-Text: Converts voice input to text for emergency analysis
- Text-to-Speech: Reads instructions aloud with optimized pacing
- Offline Support: Works even without internet connection
| Emergency Type | Response Time | Keywords Detected |
|---|---|---|
| ๐ซ Cardiac Arrest | < 30 seconds |
"not breathing", "no pulse", "collapsed" |
| ๐ซ Choking | < 15 seconds |
"choking", "can't breathe", "airway blocked" |
| ๐ฉธ Severe Bleeding | < 20 seconds |
"bleeding", "deep cut", "hemorrhage" |
| ๐ฅ Burns | < 25 seconds |
"burn", "scalded", "thermal injury" |
| ๐ต Fainting | < 10 seconds |
"fainted", "unconscious", "passed out" |
| ๐คง Allergic Reaction | < 15 seconds |
"allergic reaction", "anaphylaxis", "swelling" |
| Country | Emergency Number | Medical Emergency |
|---|---|---|
| ๐บ๐ธ United States | 911 | 911 |
| ๐ฌ๐ง United Kingdom | 999 | 999 |
| ๐ช๐บ European Union | 112 | 112 |
| ๐ฎ๐ณ India | 108 | 108 |
| ๐ฆ๐บ Australia | 000 | 000 |
| ๐จ๐ฆ Canada | 911 | 911 |
| ๐ฏ๐ต Japan | 119 | 119 |
| [And 8 more...] |
# Initialize speech processor
speech_processor = SpeechProcessor()
# Convert speech to text
text = speech_processor.speech_to_text()
# Convert text to speech
speech_processor.text_to_speech("Emergency detected. Follow these steps.")# Initialize AI engine
detector, response_generator = create_ai_engine()
# Detect emergency
emergency = detector.detect_emergency("Person is choking")
# Generate response
response = response_generator.generate_response(emergency)# Find nearby hospitals
location_helper = LocationHelper()
hospitals = location_helper.find_nearby_hospitals(lat, lon)
# Generate map URL
map_url = location_helper.generate_maps_url(lat, lon, "hospital")User: "My friend fell and hit their head, they're bleeding from a cut on their forehead"
Sahaaya: ๐ฉธ Severe Bleeding detected (87% confidence)
โ ๏ธ HIGH PRIORITY: Follow these steps immediately:
Step 1: Ensure Safety
Put on gloves if available. Ensure the scene is safe...
User: [Speaks] "Someone is choking on food and can't speak"
Sahaaya: โ
Heard: "Someone is choking on food and can't speak"
๐ซ Choking detected (95% confidence)
๐จ CRITICAL: Follow these steps while calling emergency services!
# Optional: Set default country for emergency numbers
DEFAULT_COUNTRY=US
# Optional: Enable advanced logging
ENABLE_ANALYTICS=true
# Optional: Set custom cache directory
CACHE_DIR=./cacheSee .streamlit/config.toml for theme and server settings.
- Fork this repository
- Connect to Streamlit Cloud
- Deploy with one click!
# Create Heroku app
heroku create sahaaya-emergency-app
# Deploy
git push heroku mainFROM python:3.9-slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 8501
CMD ["streamlit", "run", "app.py"]# Run AI engine tests
python -m utils.ai_engine
# Run speech processing tests
python -m utils.speech_utils
# Run helper function tests
python -m utils.helpers
# Test emergency detection
python test_emergency_scenarios.pyWe welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow PEP 8 style guide
- Add docstrings to all functions
- Include unit tests for new features
- Update README for significant changes
Sahaaya includes built-in analytics to help improve emergency response:
# Log emergency events
logger.log_emergency_event({
"emergency_type": "cardiac_arrest",
"confidence": 0.95,
"response_time": "12 seconds",
"steps_completed": 3
})
# Log user interactions
logger.log_user_interaction("voice_input", {
"duration": "5 seconds",
"transcription_accuracy": "high"
})-
Medical Disclaimer: Sahaaya is not a substitute for professional medical care. Always call emergency services for serious medical emergencies.
-
Training Supplement: This app should supplement, not replace, proper first-aid training.
-
Regional Variations: Medical protocols may vary by region. Consult local emergency services for region-specific guidance.
-
Accuracy: While we strive for accuracy, emergency protocols should be verified with medical professionals.
Sahaaya - Your AI Partner in Moments that Matter
git clone https://github.com/your-username/sahaaya.git
cd sahaaya
pip install -r requirements.txt
streamlit run app.py