-
-
Hybrid AI Architecture — On-device (Gemini Nano / Apple Foundation Models) + Gemini cloud fallback via Firebase AI Logic
-
Inspection Dashboard — Track active, in-progress, and verified inspection reports
-
Hybrid AI Damage Detection — Pixel-precise damage outlines with severity and confidence
-
Detected Findings & Interactive Editing — Refine, add, or remove damage areas
-
Deterministic Cost Estimation — Sourced rate cards and reusable custom unit-rate overrides
-
Report-Grounded AI Assistant — Ask questions strictly grounded in the open inspection report
-
Mobile App - iOS - Preview
-
Mobile App - Android - Preview
Inspiration
Field inspections of buildings, bridges, pipes, tanks, and industrial equipment are still painfully manual. Inspectors take dozens of photos on site, transfer them later, manually trace damaged areas, look up repair procedures, build cost estimates in spreadsheets, and assemble PDF reports by hand.
On top of that, real inspection sites often have unreliable connectivity and strict privacy requirements for client photos—yet pure on-device models can struggle with high-precision spatial tasks, and pure LLMs should never be trusted to invent repair prices.
We built Delokbase to bridge that gap: an end-to-end visual inspection app powered by Firebase AI Logic Hybrid Inference, combining fast, private on-device AI with automatic Gemini cloud fallback and deterministic, auditable server-side pricing.
What it does
Delokbase turns site photos of any object or material into a verified, shareable inspection report:
- Capture & Private Upload — Take or drag-and-drop up to 10 JPEG/PNG photos with inspection metadata (object, location, weather, inspector, currency, and indirect cost percentages). Photos are stored privately per user in Cloud Storage.
- Hybrid AI Damage Detection & Pixel-Precise Outlines — Detects visible damage (cracks, spalling, exposed rebar, corrosion, coating failure, delamination, moisture, deformation, etc.) with material, structural element, severity, and confidence. Findings are refined with a close-up pass (segmentation/tracing + on-device pixel snapping) so outlines hug actual damage boundaries.
- Human-in-the-Loop Review & Measurement — Inspectors can add, redraw, rename (using a reusable damage catalog), or remove false positives, then approve findings and measure quantities either directly on the photo (using a reference scale) or via field measurements.
- Deterministic Sourced Cost Estimation — Cloud Functions compute line-by-line estimates using sourced Firestore rate cards and the inspector's own reusable unit-rate overrides (matched by specificity: damage name + element > damage name > element > damage type). The AI never invents prices.
- RAG-Grounded Repair & Prevention Plan — Retrieves relevant engineering guideline excerpts from Firestore and generates prioritized repair steps and prevention measures with explicit source citations.
- Frozen PDF Report & Report-Only Q&A Chat — Generates a complete, annotated PDF report on device, archives it immutably in Cloud Storage, sends push notifications when milestones complete, and provides an AI report assistant (with contextual follow-up chips) grounded strictly in the open report.
How we built it
Delokbase is built with Flutter and Firebase, targeting Web (Chrome), Android, and iOS (plus macOS/Windows support).
Firebase AI Logic Hybrid Inference
Every AI task is routed through HybridAiEngine, which prefers on-device inference first and seamlessly falls back to Gemini in the cloud via Firebase AI Logic—recording which runtime served each result and logging fallbacks to Analytics and Crashlytics:
| Platform | On-Device Runtime | Cloud Fallback |
|---|---|---|
| Web (Chrome) | Gemini Nano via Firebase AI Logic JS SDK (InferenceMode.ONLY_ON_DEVICE in web/firebase_local_ai.js) |
Gemini via firebase_ai |
| Android | Gemini Nano via com.google.firebase:firebase-ai & firebase-ai-ondevice (MainActivity.kt) |
Gemini via firebase_ai |
| iOS | Apple Foundation Models (SystemLanguageModel) + FirebaseAILogic (AppDelegate.swift) for text tasks |
Gemini via firebase_ai (photos & fallback) |
All prompts, JSON schemas, and response parsers are shared across runtimes (lib/data/ai/prompts.dart), and cloud inference uses limited-use App Check tokens (useLimitedUseAppCheckTokens: true).
Full Firebase Ecosystem
- Firebase App Check: reCAPTCHA Enterprise (Web), Play Integrity (Android), App Attest / DeviceCheck (Apple), and debug provider in development—enforced across Cloud Functions callables, Firestore, Storage, and Firebase AI Logic.
- Firebase Authentication: Email/Password (with verification & password reset) and Google Sign-In.
- Cloud Firestore: Inspections, versioned shared & personal rate cards, custom unit-rate overrides, damage catalog, repair guidance RAG corpus, and FCM device tokens—protected by strict per-user Security Rules.
- Cloud Storage: Private, immutable photo slots and frozen PDF reports enforced by cross-service Storage Rules (
firestore.get()). - Cloud Functions (v2, Node.js 22 + Zod): Rate-limited idempotent reservation (
beginInspection), Storage finalization triggers (inspectionFileFinalized), expiring detection leases (claimDetection/releaseDetection/completeDetection), authoritative costing (prepareReport), and FCM status notifications (notifyInspectionStatus). - Firebase Cloud Messaging, Analytics, Crashlytics & Hosting: Push notifications on web/mobile, runtime telemetry, crash reporting, and live web deployment at delokbase.web.app.
Challenges we ran into
- Unified Hybrid AI across 3 native/web runtimes in Flutter: Chrome's Prompt API / Firebase JS AI SDK, Android's
firebase-ai-ondevice, and iOS's Apple Foundation Models each expose different APIs and capabilities (e.g., iOS Foundation Models is text-only, while Chrome/Android Gemini Nano supports multimodal input). We designed a cleanAiEngineabstraction with thin native MethodChannels (delokbase/hybrid_ai) and JS interop (delokLocalAI) so the rest of the app stays platform-agnostic. - Private Storage reads on Web with App Check enforced: FlutterFire's web
getData()fetches download URLs with a plainGETwithout Auth/App Check headers, causing 403/CORS failures once App Check is enforced. We solved this by bridging directly to the Firebase JS SDK'sgetBytes()(web/firebase_storage_bytes.js), which attaches both Auth and App Check tokens cleanly. - Accurate damage outlines & trustworthy pricing: Raw bounding boxes from first-pass detection are too coarse for real area/length measurements. We added a close-up refinement pipeline (segmentation masks / trace pass + on-device pixel-level edge snapping) and kept all financial calculations strictly deterministic on the backend.
- Idempotent, race-safe inspection workflow: Storage finalized events are delivered at-least-once and out of order. We built Firestore transactions with slot tracking and expiring detection leases, verified end-to-end with the Firebase Emulator Suite (
npm test).
Accomplishments that we're proud of
- Delivering true multi-platform hybrid AI across Web, Android, and iOS from a single Flutter codebase using Firebase AI Logic.
- Building a complete, coherent product rather than a raw AI wrapper—covering capture, visual annotation, photo-calibrated measurement, sourced cost estimation, RAG guidance, PDF export, and grounded chat.
- Protecting the entire pipeline with Firebase App Check, strict Firestore/Storage Security Rules, Zod-validated Cloud Functions, and automated unit + Firebase Emulator integration tests.
What we learned
- Hybrid inference shines when you match each task to the right runtime: fast, private on-device models for initial detection, guidance, repair planning, and report chat, paired with cloud Gemini for high-resolution geometric tracing/segmentation and universal fallback.
- Pairing generative AI with human-in-the-loop review and deterministic server-side pricing turns a cool AI demo into a tool field engineers can actually trust.
What's next for Delokbase
- Official App Store & Google Play Store releases: Full Android (Gemini Nano) and iOS (Apple Foundation Models) builds are already implemented in our open-source GitHub repository and can be cloned and run locally today. Publishing to the Apple App Store and Google Play Store is our immediate next step—we held off during the hackathon due to store developer account fees on a bootstrapped budget.
- Offline-first inspection queue with automatic background sync when field inspectors return to cellular coverage.
- Team workspaces, shared organization rate cards, and multi-inspector approval workflows.
- Historical damage tracking across repeated inspections of the same asset to monitor deterioration over time.
Try it out
- Open the live web app: https://delokbase.web.app (use Chrome with Gemini Nano enabled to see on-device inference in action, or any modern browser to see automatic Gemini cloud fallback).
- Sign in with Google or create an account with Email & Password.
- Upload one or more photos of any structure/object (e.g., a cracked wall, rusted pipe, or peeled coating), run detection, review/measure the findings, generate the cost estimate & repair plan, export the PDF report, and ask the Report Assistant questions about the report.