惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
有赞技术团队
有赞技术团队
V
Visual Studio Blog
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
Vercel News
Vercel News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
The Cloudflare Blog
宝玉的分享
宝玉的分享
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
TripSync — A Three-Tier Gemma 4 Travel Planner Running Li...
William · 2026-05-10 · via DEV Community

This is a submission for the Gemma 4 Challenge: Build With Gemma 4.


What I Built

TripSync is a live AI travel planner that takes plain-English trip descriptions and returns real destination recommendations with flight estimates, hotel options, and booking links.

Live app: tripsync-ilao.onrender.com

GitHub: github.com/Tripsync-justmeMedia/tripsync

Stack: Python / Flask · Vanilla HTML/JS · SQLite · Render · Ollama · Gemini API


Why Gemma 4

Every search on TripSync hits an AI API. Every destination card, every itinerary, every refinement — that's a call to a cloud model. Free tiers end. Traffic grows. And suddenly the thing you built for enjoyment is costing you money before it's made you a cent.

Gemma 4 solved two problems at once:

The cost problem — running locally means zero marginal cost per query. No traffic spike will break the budget.

The privacy problem — travel data is personal. Budgets, travel dates, who you're travelling with. Gemma 4 running locally means that data never leaves the user's device. That's a real feature, not a marketing claim.

I chose the gemma4 (9.6GB) model via Ollama for local inference on an M1 MacBook with 16GB unified memory — the limit of real consumer hardware. For the cloud API tier I chose gemma-3-12b-it via the Gemini API — fast enough for live users, no local setup required.


The Three-Tier Architecture

TripSync runs three AI modes, switchable with one toggle:

☁️ Cloud AI — Groq, fast, reliable, the default

✨ Gemma 4 Expert — Gemma 4 12B via Gemini API, full Gemma 4 quality for every live user, no local setup needed

🔒 Private AI — Gemma 4 running locally via Ollama, zero data leaving the device

One toggle. All three live right now.


The Code

Local Gemma 4 endpoint:

@app.route('/api/tripsync-local', methods=['POST'])
def tripsync_local():
    data = request.get_json()
    prompt = build_prompt(data)
    result = call_ollama(prompt)
    if not result:
        return jsonify({"error": "Local AI unavailable"}), 503
    parsed = extract_json_safe(result)
    if not parsed:
        return jsonify({"error": "Could not parse response"}), 500
    return jsonify(parsed)

Enter fullscreen mode Exit fullscreen mode

Gemma 4 via Gemini API with silent fallback:

def call_gemma_api(prompt):
    try:
        model = genai.GenerativeModel("gemma-3-12b-it")
        response = model.generate_content(prompt)
        return response.text
    except Exception as e:
        print(f"Gemma API error, falling back to Groq: {e}")
        return call_groq(prompt)

Enter fullscreen mode Exit fullscreen mode

Frontend toggle — three modes, one click:

const modes = ['cloud', 'gemma', 'local'];
const labels = {
  cloud: { icon: '☁️', label: 'Cloud AI' },
  gemma: { icon: '', label: 'Gemma 4 Expert' },
  local: { icon: '🔒', label: 'Private AI' }
};

Enter fullscreen mode Exit fullscreen mode


What Gemma 4 Unlocked

Before Gemma 4, TripSync had one AI mode — cloud, via Groq. Every query left the user's machine. Free tier limits capped growth.

After Gemma 4:

  • Users with privacy concerns have a real, working, verifiable local option
  • The app can serve Gemma 4 quality to live users via the Gemini API free tier at zero cost
  • The architecture scales — local for privacy, API for quality, cloud for speed Gemma 4 didn't just add a feature. It changed the architecture of the whole app.

Honest Performance Notes

  • Local cold start: 30–45 seconds on M1 16GB. Warm queries under 1 second.
  • Gemma 4 Expert via API: 10–15 seconds after warmup for three fully curated destination cards.
  • Silent fallback: if the Gemini API rate limits or times out, Groq catches it instantly. Users never see an error. Close Chrome when running local. Give Ollama the RAM it needs. The model isn't slow — a loaded machine is slow.

Try It

Switch to ✨ Gemma 4 Expert mode on the live site and run any travel search. Results come back in 10–15 seconds with destination cards, match scores, booking links, and activity suggestions — all powered by Gemma 4.

Switch to 🔒 Private AI mode and follow the GitHub setup guide to run it fully locally on your own machine.

Live app: tripsync-ilao.onrender.com

GitHub: github.com/Tripsync-justmeMedia/tripsync


William Commu — Just Me Media

Minesing, Ontario

@nightowl on DEV