DEV Community

Cover image for When Networks Fail, SARA Stands Up: Offline Flood Rescue with Gemma 4 E4B
Muhammad Asim Hanif
Muhammad Asim Hanif

Posted on

When Networks Fail, SARA Stands Up: Offline Flood Rescue with Gemma 4 E4B

Gemma 4 Challenge: Build With Gemma 4 Submission

This is a submission for the Gemma 4 Challenge: Build with Gemma 4

What I Built

During major floods—like the catastrophic 2022 Pakistan Floods that displaced over 33 million people—mobile towers lose power and internet services collapse. This creates a critical communication blackout where stranded victims cannot signal for help, and rescue teams deploy boats, helicopters, and medical assets based on guesswork.

SARA (Safety And Rescue Assistant) is a 100% offline-first, local emergency command center. Deployed on a single coordinator laptop alongside a simple Wi-Fi hotspot, it creates a private local network—no internet required.

The SARA End-to-End Rescue Flow

SARA simplifies disaster coordination into a seamless, offline process:

SARA End-to-End Rescue Flow

Flood victims connect to the hotspot (SARA-HELP) and access SARA’s intake form using their mobile browser—no app installation needed.

  • Victims can submit emergency details via text, photo evidence (water depth, injuries), or a recorded voice message.

Victim Emergency Request Form

  • Coordinators manage resources through a live-updating Glassmorphic Admin Dashboard equipped with offline Leaflet maps, live WebSocket streams, and RAG-integrated medical protocols.

SARA Command Center Dashboard


Demo

Here is the walkthrough of SARA's offline system deployment, victim-side emergency reporting form, and real-time dashboard triage updates:


Code

The complete codebase, configurations, and deployment steps are fully open-source and available on GitHub:

👉 GitHub Repository: SARA Offline Rescue


How I Used Gemma 4

At the center of SARA is Google's Gemma 4 Edge-optimized family (gemma4:e4b / 4B) running locally on the coordinator laptop via Ollama.

Gemma 4 powers SARA in three major ways:

1. Intentional Model Selection: Why Gemma 4 E4B?

Disaster response centers operate on battery backups or portable generators. I needed a highly capable model that could run locally on consumer-grade laptop CPUs/GPUs without needing a connection to cloud servers. Gemma 4 4B fits comfortably within under 8GB VRAM, delivering stable, sub-5-second local inferences in the field.

2. Native Multimodality & Offline RAG Integration

Stranded victims report emergencies under high stress. Gemma 4's native multimodal capabilities allow me to process multiple modalities in a single pipeline without context switching.

SARA Offline RAG and AI Pipeline

  • Audio: Local voice messages are transcribed seamlessly.
  • Vision: Photo uploads are evaluated directly by the model to detect water depth, trapped individuals, or visible injuries.
  • Offline RAG: The system searches local manuals from WHO and the National Disaster Management Authority (NDMA) Pakistan using local nomic-embed-text embeddings, injecting critical first-aid instructions into Gemma's prompt.
  • Bilingual Generation: Gemma 4 acts as a translation engine, analyzing English/Roman Urdu inputs and writing simple, reassuring Urdu summary updates for the victim.

Victim Status Update in Urdu and English

3. Agentic Task Coordination via Tool Calling

SARA provides a natural language command box for rescue coordinators. When a coordinator types "Are there any available rescue boats?" or "Dispatch helicopter to case #3", Gemma 4 maps the query to custom Python tools (dispatch_rescue_team, get_resource_status, etc.) via Ollama's native tool calling. It updates the SQLite database, triggers WebSocket alerts, and returns structured confirmation text—all fully offline.

Top comments (0)