Skip to content

DiyaMenon/Sahaaya

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ†˜ Sahaaya - AI Emergency Aid Companion

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

๐ŸŒŸ Features

๐ŸŽฏ Core Functionality

  • ๐Ÿค– 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

๐ŸŽจ User Experience

  • โœจ 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

๐Ÿš€ Quick Start

Option 1: Run on Streamlit Cloud (Recommended)

  1. Fork this repository to your GitHub account
  2. Visit Streamlit Cloud
  3. Deploy directly from your forked repository
  4. Share your app with the world! ๐ŸŒŽ

Option 2: Local Development

# 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.py

The app will open at http://localhost:8501 ๐ŸŽ‰

๐Ÿง  How It Works

1. Emergency Detection AI

# 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)

2. Step-by-Step Guidance

{
  "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"
}

3. Voice Integration

  • 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

๐Ÿฉบ Supported Emergencies

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"

๐ŸŒ Global Emergency Numbers

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...]

๐Ÿ”Œ API and Integrations

Voice Processing

# 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.")

Emergency Detection

# 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)

Location Services

# 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")

๐Ÿ“ฑ Usage Examples

Text Input

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...

Voice Input

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!

๐Ÿ”ง Configuration

Environment Variables

# Optional: Set default country for emergency numbers
DEFAULT_COUNTRY=US

# Optional: Enable advanced logging
ENABLE_ANALYTICS=true

# Optional: Set custom cache directory
CACHE_DIR=./cache

Streamlit Configuration

See .streamlit/config.toml for theme and server settings.

๐Ÿš€ Deployment

Streamlit Cloud

  1. Fork this repository
  2. Connect to Streamlit Cloud
  3. Deploy with one click!

Heroku

# Create Heroku app
heroku create sahaaya-emergency-app

# Deploy
git push heroku main

Docker

FROM python:3.9-slim

WORKDIR /app
COPY . .

RUN pip install -r requirements.txt
EXPOSE 8501

CMD ["streamlit", "run", "app.py"]

๐Ÿงช Testing

# 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.py

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guide
  • Add docstrings to all functions
  • Include unit tests for new features
  • Update README for significant changes

๐Ÿ“Š Analytics and Logging

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"
})

โš ๏ธ Important Disclaimers

  1. Medical Disclaimer: Sahaaya is not a substitute for professional medical care. Always call emergency services for serious medical emergencies.

  2. Training Supplement: This app should supplement, not replace, proper first-aid training.

  3. Regional Variations: Medical protocols may vary by region. Consult local emergency services for region-specific guidance.

  4. Accuracy: While we strive for accuracy, emergency protocols should be verified with medical professionals.


๐Ÿ†˜ Built with โค๏ธ for Saving Lives

Sahaaya - Your AI Partner in Moments that Matter

๐Ÿš€ Deployed Link

๐Ÿš€ Get Started Now

git clone https://github.com/your-username/sahaaya.git
cd sahaaya
pip install -r requirements.txt
streamlit run app.py

Your emergency companion is ready to help! ๐Ÿš‘โœจ

Sahaaya

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages