
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass
What I Built
SafeAir Walk tells you the single best 1-hour window to step outside today β based on real air quality forecasts and heat β tailored to your health profile. Then a local open-source AI explains why in plain language, in your language of choice.
Air pollution and heat are invisible threats that people routinely ignore because the data is buried in dense charts. SafeAir Walk turns hourly AQI + apparent temperature forecasts into one clear, colour-coded verdict:
- β Go for it β conditions are safe, head out now
- π‘ Short walk only β keep it to 20β30 minutes
- β Skip today β air or heat is too high, try tomorrow
It is built for four health profiles: General, Child πΆ, Elder π΄, and Asthma / Respiratory π¨ β each with tighter safety thresholds where it matters. The app uses your GPS or lets you search any city, then streams a warm, practical 2-sentence AI explanation β not a wall of warnings, just what to do and why.
The whole idea is to get people off the screen and safely into the world. When conditions are good, SafeAir Walk simply says "Go for it" and gives you a time. When they're bad, it suggests an indoor alternative and shows when tomorrow looks better.
No sign-ups. No API keys. No ads. Just open data and a fast, private Ollama LLM.
Demo
π Live app: https://safeair-walk.onrender.com/
Search your city (or tap "Use my location") and you'll see:
- The best hour to walk today
- AQI, PM2.5, and feels-like temperature for that window
- A streaming AI explanation personalised to your health profile powered by Ollama
- An hourly dot-strip showing how the whole day looks at a glance
Code
SafeAir Walk
Find your clean-air window to go outside. Checks AQI and heat for your area and picks the best 30β60 min window today.
Stack: React + Vite + Open-Meteo (no API key) + Ollama (local AI, optional)
Run locally
pnpm install
pnpm dev
Enable AI explanations (optional)
# Windows PowerShell
$env:OLLAMA_ORIGINS="*"; ollama serve
The app auto-detects Ollama and uses it. Falls back to templates if offline.
Deploy (Free)
Two services:
- HuggingFace Space β runs Ollama API (free Docker Space)
- Render Static Site β hosts the React app (free)
Step 1 β Deploy Ollama to HuggingFace Spaces
- Go to https://huggingface.co/new-space
- Set:
-
Space name:
safeair-ollama - SDK: Docker
- Visibility: Public
-
Space name:
- Upload the three files from the
hf-space/folder:Dockerfilehf_start.shREADME.md
- Wait ~5 min for the build + model download to finish
- Your Ollama URL will be:
Test it:
https://YOUR-HF-USERNAME-safeair-ollama.hf.spacecurl https://YOUR-HF-USERNAME-safeair-ollama.hf.space/api/tags
Step
β¦How I Built It
Open-source AI: Ollama + Qwen 2.5 (Local Inference)
The AI layer runs entirely on Ollama with open-weight models β no external proprietary APIs, no OpenAI, no Anthropic.
-
Model:
qwen2.5:1.5b/qwen2.5:7bβ ultra-fast open-weight models capable of running seamlessly on consumer hardware. -
Inference runtime: Ollama β models are served directly via
ollama serve, exposing a streaming/api/generateand/api/tagsendpoint with CORS enabled (OLLAMA_ORIGINS=*). -
Streaming integration: The React frontend connects directly to Ollama's HTTP API, consuming NDJSON chunks via
ReadableStreamandTextDecoderto render tokens with a real-time typing effect.
The Scoring Engine & Deterministic Thresholds
To guarantee safety and scientific consistency, SafeAir Walk does not rely on LLM guesswork for health boundaries. All safety decisions are evaluated deterministically in src/safeair-core.js β PROFILES before any prompt is generated:
| Profile | GO | SHORT | SKIP |
|---|---|---|---|
| General | AQI β€ 100, Feels like β€ 32Β°C | AQI β€ 150, Feels like β€ 36Β°C | Above thresholds |
| Child | AQI β€ 75, Feels like β€ 30Β°C | AQI β€ 100, Feels like β€ 34Β°C | Above thresholds |
| Elder | AQI β€ 75, Feels like β€ 30Β°C | AQI β€ 100, Feels like β€ 34Β°C | Above thresholds |
| Asthma | AQI β€ 50, Feels like β€ 32Β°C | AQI β€ 100, Feels like β€ 36Β°C | Above thresholds |
- Fetch β two parallel requests to Open-Meteo (free, no API key): air quality API for US AQI + PM2.5, and weather API for apparent temperature across 48 forecast hours.
- Rate β each hour is evaluated against the selected profile's limits. If temperature is unsafe even when AQI is low (or vice versa), the app strictly selects the safer, conservative rating.
- Pick β the algorithm evaluates today's daytime hours (5 AMβ8 PM), selects the optimal window, and alerts the user if conditions deteriorate soon after.
- AI Role β Ollama receives these structured verdicts to craft warm, supportive, plain-language advice without hallucinating risk limits.
- Fallback β if Ollama is offline or unavailable, deterministic templates instantly respond with zero downtime.
Frontend & Deployment
- React 19 + Vite β fast single-page app.
- Vanilla CSS β dark glassmorphism theme with accessible contrast and micro-animations.
-
Render β static web app hosting with automated build pipelines (
pnpm install && pnpm build).
| Layer | Technology | Cost |
|---|---|---|
| AI Engine | Ollama (qwen2.5) |
Free & Open Source |
| Web App Hosting | Render Static Site | Free |
| Weather & AQI | Open-Meteo API | Free, no key required |
| Geocoding | Open-Meteo Geocoding API | Free, no key required |
Why Does Open Innovation Matter?
With a closed API, I would have had to pay per token, accept rate limits, and transmit every user's health profile and location data to an external provider's servers.
Open innovation with Ollama made three critical things possible:
- Privacy by architecture. Ollama runs locally and independently. User queries, locations, and personal health profiles never leave the user's control. There are no tracking scripts, user accounts, or cloud telemetry pipelines.
- Zero subscription / API fees. Because Ollama runs open-weight models, developers and users are completely free from monthly subscription tiers, credit card requirements, or surprise billing spikes. Anyone can clone the repo and run the entire AI stack for free.
-
Complete prompt & latency ownership. With Ollama, we have full control over sampling parameters (
temperature,num_predict), token streaming, and response structure. There are no unexpected model deprecations, forced safety overrides, or arbitrary rate limit throttling.
Open innovation turned what would normally be an expensive, privacy-invasive cloud service into a fast, private, community-owned tool that gets people safely outdoors.
Prize Categories
-
Ollama β Open-weight model inference (
qwen2.5) with streaming API served entirely via Ollama - Render β React frontend deployed as a Render Static Site
Top comments (0)