Skip to content

About

LensCraft is a hybrid-AI photography learning companion that turns phone shots into evidence-backed feedback, personalized technique maps, and next-shot experiments. Built with Firebase AI Logic, on-device Gemini Nano, cloud Gemini, Android/Kotlin, Vue 3, and Google ADK.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LensCraft

Learn to see like yourself...

LensCraft learns from every Shot, closes each Shoot into a learning record, offers one personal Experiment, and tracks what changes.

It is built for the self-directed phone photographer who knows some Techniques but cannot tell whether their decisions are becoming deliberate or they are just getting lucky. LensCraft intercepts ordinary Camera still images, groups Scenes into one natural Shoot, records what repeated or varied, updates longitudinal memory, and chooses one justified next step. It does not score artistic quality.

A model may interpret a Shot. Only the photographer supplies Intent, Keeper preference, and the signal that a Change was an improvement. Unmarked Shots remain unknown rather than disliked.

Entry for the Firebase #BuildHybridAI Hackathon.

Live Demo & Downloads

Surface URL / Artifact Notes
Live Web App lenscraft-hybridai-production.up.railway.app Full-stack Railway deployment; Firebase AI Logic + reCAPTCHA Enterprise App Check active for every browser
Demo Video YouTube Walkthrough End-to-end Firebase AI Logic Hybrid Quick Read + Android Phone Source + Web Desk + Railway proof
Android Debug APK v1.0-hackathon Release (app-debug.apk) Pre-configured for the live Railway origin; supports Google Sign-In & Judge Demo Passcode
Sign-In Options Google OAuth 2.0 & Judge Demo Passcode Passcode endpoint POST /auth/judge-login (web) and POST /auth/android/judge-session (Android); reviewer passcode provided in Devpost Testing Credentials
Legal & OAuth Compliance /privacy · /terms Served directly from the application origin

Hybrid AI Architecture

LensCraft uses Firebase AI Logic hybrid inference (InferenceMode.PREFER_ON_DEVICE) protected by Firebase App Check (firebaseml.googleapis.com: ENFORCED) to deliver two levels of feedback across Web and Android:

Layer Where it runs What it does Implementation
Quick Read (On-Device) Gemini Nano (Android AICore / Chrome Prompt API) Instant impression, taxonomy Technique spotting, and mood (< 2s, offline-capable) HybridInference.kt · firebase.js
Quick Read (Cloud Fallback) Firebase AI Logic (gemini-3-flash-preview → gemini-3.5-flash-lite) via Firebase App Check Automatic cloud fallback when Gemini Nano is unavailable; persists authoritative inference_source to POST /api/hybrid/quick-read Web: reCAPTCHA Enterprise · Android: Play Integrity / Debug
Deep Analysis Panel Backend Google ADK (SequentialAgent + ParallelAgent: Tech, Comp, Story + Synthesizer) Multi-lens Evidence, Findings, EXIF-verified Judge Criteria, Technique Map updates, Shoot settlement analyst.py · runtime.py
Multi-Provider Quota Backup Groq Cloud (qwen/qwen3.8-27b vision · openai/gpt-oss-120b text) Bounded structured backup when Gemini quotas or timeouts trigger groq_fallback.py

Why hybrid AI fits photography

A photographer standing outdoors may have no internet. Gemini Nano gives them immediate, private feedback the moment a Shot is made — a quick read of what Technique they used and what stands out. When connectivity is present, Firebase AI Logic automatically falls back to Cloud Gemini 3 Flash guarded by Firebase App Check, while the backend runs the deep three-lens Analyst panel asynchronously ("Single preliminary read; deep panel settled") and updates the Technique Map and Journey.

Submission scope is the autonomous still-image Shoot loop. Gemini Live, Live Scene Sessions, Scene Probes, the post-Shot Coach, a custom viewfinder, and video Analysis are parked outside the submission and current roadmap.

Repository and Hybrid AI Lineage

LensCraft-HybridAI is initialized at 35c252b (November 24, 2026) and builds on the shared Visual QA (visual-qa-agent / VizRabbit) grid math, imaging helpers, ADK runtime, storage adapters, OAuth setup, and Vue 3 shell — extended through the full commit history with the photography domain, Shot-review agents, Technique Map, Experiment workflow, Android Phone Source, Shoot Records, Journey, visual-story exports, Firebase AI Logic hybrid inference (PREFER_ON_DEVICE), Firebase App Check security, and full-stack Railway container deployment.

Architecture

LensCraft hybrid AI architecture: Firebase AI Logic PREFER_ON_DEVICE, App Check, Google ADK, and Groq backup

Clients execute Firebase AI Logic (PREFER_ON_DEVICE) for instant Quick Reads (Gemini Nano on-device → Cloud Gemini 3 Flash behind Firebase App Check) and post results to /api/hybrid/quick-read. On the backend, replay-safe code stages coordinate the Google ADK Analyst panel, settle per-Shot Runs behind code-owned barriers into one revisioned Shoot Record, and deliver identical read models to Android and Web (plus FCM notices to Android).

Open the full-size diagram · Read the architecture notes · Inspect the detailed backend topology

The web remains the detailed audit desk. Android is the daily client: Now, Shots, Experiments, Journey, and Settings. Drive is an optional import and export adapter.

The Phone Source (android/, Kotlin + Compose + WorkManager) keeps Android's normal camera in control. After one honest media permission, it watches only approved Camera media, streams unseen originals directly and idempotently, freezes explicit Capture Session membership, survives UI exit, and shows import/retry state. Selected-media access stays manual. Native Google identity, passcode-gated Judge Demo Access (/auth/android/judge-session), and revocable device sessions are implemented; Firebase AI Logic, App Check, OAuth, FCM, App Links, and a production-connected debug APK (v1.0-hackathon) are configured. Human native sign-in completion, production Play Integrity signing, and full physical-device acceptance remain. Pairing endpoints remain only for older APKs.

The current implementation has per-Shot Runs, client-side Firebase AI Logic Quick Reads synced via /api/hybrid/quick-read, one bounded Shot Teaching Receipt, typed Reproduce and Explore Capture Sessions, Technique Map, Tendency Profile, Change, Journey, persisted Scene/Shoot grouping, revisioned terminal Shoot Records, deterministic evidence-labelled Shoot receipts, scoped Photographer Signals, Mine/Inspiration authority, code-gated Scout help, replayable Intervention Records that adapt after repeated comparable outcomes, and evidence-bound Deconstruction carousels with photographer-owned covers. Android caches and leads Now with the current Shoot state or newest valid receipt. LensCraft is deployed on Railway (alongside the Cloud Run deployment reference) and live Web authenticated acceptance + Firebase AI Logic Quick Read passed; continuous Phone Source and physical-device acceptance remain incomplete.

Prerequisites

  • Python ≥ 3.12 and uv
  • Node ≥ 20
  • ffmpeg and ffprobe on PATH
  • A Google Cloud project with Vertex AI enabled, or an AI Studio key for local work

Setup

cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env

Fill in backend/.env and frontend/.env (see the comments in each file). For Firebase AI Logic & App Check on Web, enable Firebase AI Logic in your Firebase Console, set VITE_FIREBASE_* values in frontend/.env, and keep VITE_APPCHECK_DEBUG_TOKEN=true for local/hackathon debug token verification (or provide VITE_RECAPTCHA_ENTERPRISE_SITE_KEY). On Android, provide the SHOOTS_FIREBASE_* Gradle properties (see Android setup); debug builds use DebugAppCheckProviderFactory and release builds use PlayIntegrityAppCheckProviderFactory. Then:

cd backend && uv sync
cd frontend && npm install

Run

start_dev.bat

Backend on http://localhost:8000, frontend on http://localhost:5173 (Vite proxies /api, /auth, /drive).

Verify

cd backend && uv run pytest

The suite uses real files, real ffmpeg, real stores, and integration contracts for retry and concurrency. Agent quality is not inferred from mocked Gemini calls. backend/scripts/check_learning_quality.py runs the real Ingest and Analyst stages against a labelled manifest and saves a versioned report; the narrower live-model probes remain under backend/scripts/check_*.py.

Deploy

Option A: Railway (Full-Stack Single Container)

railway.json and Dockerfile build the Vue 3 SPA and FastAPI backend into one container on one origin (zero CORS or cross-site cookie setup):

  1. Connect the Niss54/LensCraft-HybridAI repository on Railway and deploy from Dockerfile.
  2. Mount a persistent volume at /data (optional, recommended): RAILWAY_VOLUME_MOUNT_PATH automatically places store.json, blobs, and local OAuth tokens under /data/blobs.
  3. When you generate a Railway public domain, RAILWAY_PUBLIC_DOMAIN automatically derives FRONTEND_ORIGIN, OAUTH_REDIRECT_URI, DRIVE_WEBHOOK_URL, and SESSION_HTTPS_ONLY=true.
  4. Set required environment variables on Railway:
    • GOOGLE_API_KEY, MODEL_FLASH=gemini-3-flash-preview, HYBRID_CLIENT_MODEL=gemini-3-flash-preview, and optional GROQ_API_KEY (Groq multimodal/text backup when Gemini quota exhausts)
    • USE_VERTEX_AI=false, CLOUD_STATE=false, ALLOW_DEV_LOGIN=false (set GOOGLE_CLIENT_ID + GOOGLE_CLIENT_SECRET with <railway-url>/auth/callback in Google OAuth, optional JUDGE_ACCESS_CODE=<secret> for hackathon reviewers, and optional GOOGLE_SITE_VERIFICATION=<token> for Search Console)
    • SESSION_SECRET, TASKS_TOKEN
    • VITE_FIREBASE_* and VITE_RECAPTCHA_ENTERPRISE_SITE_KEY (passed cleanly as Docker build args for the frontend build)

(Optional split deployment: vercel.json and frontend/vercel.json contain rewrite rules to host only the Vue frontend on Vercel proxying /api/*, /auth/*, /drive/*, /tasks/*, and /.well-known/* to your Railway backend.)

Option B: Google Cloud Run

One Cloud Run service in asia-southeast2, running as the shoots-ingest service account, with Firestore, a GCS bucket, Secret Manager, Pub/Sub push subscriptions (one per stage, each with a dead-letter topic) and three Cloud Scheduler jobs. The image is built on Cloud Build; no local Docker needed.

export GCP_PROJECT=<project-id>
export GCP_LOCATION=asia-southeast2
export ENV_FILE=backend/.env
./infra/enable-apis.sh
ENV_FILE=backend/.env ./infra/state.sh
./infra/preflight.sh
./infra/deploy.sh
PUBSUB_PUSH_BASE_URL=https://shoots-<project-number>.asia-southeast2.run.app PUBSUB_PUSH_SA=shoots-ingest@<project>.iam.gserviceaccount.com ./infra/topics.sh
./infra/scheduler.sh

Then add <service url>/auth/callback to the OAuth client's redirect URIs. deploy.sh prints the URL; it is deterministic from the project number, so the env vars that need it are right on the first deploy.

See Cloud proof for the exact readback and unattended workflow, and Android setup for OAuth, Firebase, App Links, release signing, and physical acceptance.

About

LensCraft is a hybrid-AI photography learning companion that turns phone shots into evidence-backed feedback, personalized technique maps, and next-shot experiments. Built with Firebase AI Logic, on-device Gemini Nano, cloud Gemini, Android/Kotlin, Vue 3, and Google ADK.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages