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)
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)
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' }
};
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
Top comments (0)