Building an Offline, Open-Weight AI Cycling Coach with Llama 3.2 and Python
Hey everyone! π For this year's Hacktoberfest "Touch Grass" challenge, I wanted to build something that bridges the gap between technology and the great outdoorsβwhile keeping data privacy front and centre. MeetTouch
Hey everyone! π
For this year's Hacktoberfest "Touch Grass" challenge, I wanted to build something that bridges the gap between technology and the great outdoorsβwhile keeping data privacy front and centre.
MeetTouch Grass: Offline AI Cycling Coach: a lightweight Python utility that runs entirely on your local machine using an open-weight model to generate custom trail routes, gear checklists, and safety plans without needing an internet connection.
Why Build an Offline Cycling Coach?
Most fitness and outdoor apps rely heavily on cloud APIs, constant connectivity, and tracking your location on remote servers. As a cyclist heading out onto remote trails where cell service drops, I wanted an assistant that:
- Requires zero internet: Works deep in the woods or on remote gravel roads.
- Protects privacy: Keeps personal routes, goals, and data strictly on-device.
- Encourages presence: Focuses on offline exploration rather than endless screen time.
The Tech Stack
To keep things fast, lightweight, and completely local, I used:
Python (py) for the logic and terminal interface.
Ollama as the local inference engine.
Llama 3.2 (3B) as the open-weight model running locally on-device.
How It Works
The script prompts you for your riding location and goals, constructs an expert outdoor coaching prompt, and queries your local Llama 3.2 instance via Ollama.
Here is a sneak peek at the core script (coach.py):
python
import ollama
def generate_cycling_plan():
print("TOUCH GRASS: LOCAL OFFLINE LLAMA 3.2 COACH \n")
location = input("Enter your trail or riding location: ")
goal = input("Enter your ride goal (e.g., 20km gravel ride): ")
prompt = f"""
Act as an expert outdoor cycling coach and trail mapper. The user is riding in: {location}. Their goal is: {goal}.
Provide a structured response with:
1. Terrain and route recommendations.
2. Essential gear checklist.
3. Wildlife and traffic safety tips.
4. A screen-free outdoor encouragement tip.
"""
response = ollama.chat(model='llama3.2', messages=[
{'role': 'user', 'content': prompt}
])
print("\n YOUR OFFLINE TRAIL PLAN:")
print(response.message.content)
if name == "main":
generate_cycling_plan()
The project is fully open-source. You can check out the complete repository, clone it, and run it locally on your own machine here:
[https://github.com/Nyateya/touch-grass-bike-couch]
Let me know what you think, and happy coding (and touching grass) this Hacktoberfest!
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.