Documentation Index
Fetch the complete documentation index at: https://mintlify.com/holzerjm/civichacks-demo/llms.txt
Use this file to discover all available pages before exploring further.
Get running in 10 minutes
Follow along during the workshop or use this as a starting point for your hackathon project. You can have everything running in about 10 minutes.At the hackathon? If wifi is slow, pair up with someone who already has the model downloaded. Ollama only needs to download once—after that everything runs offline.
Prerequisites
Before you begin, make sure you have:- Python 3.10 or higher
- At least 8 GB of RAM (16 GB recommended)
- 10 GB of free disk space
- Reliable internet connection for initial download (~4.7 GB model)
Install Ollama and pull the model
Choose your platform:Then pull the Llama 3.1 model:
The model downloads once and runs offline forever. If Ollama isn’t running as a background service, start it with
ollama serve.Set up Python and install dependencies
Create a virtual environment and install the required packages:This installs:
llama-index— RAG framework for connecting AI to datallama-index-llms-ollama— Ollama integrationllama-index-embeddings-huggingface— Local embeddings (no API key needed)llama-index-readers-file— File readers for PDF, DOCX, and other formatsgradio— Web UI framework
Run the demo steps
Now you’re ready to run the demo!You’ll see the AI generate a response in real-time, followed by cost comparison:The AI will analyze real Boston 311 service data and answer questions about it.Opens at Supports Opens at
Step 1: Local AI in your terminal
Step 2: Connect AI to civic data
Pick a track:eco, city, edu, or justiceStep 3: Launch the web app
http://localhost:7860 with a full chat interface, track selector, and example questions.Step 4: Bring your own data (interactive)
Drop any file into theuserdata/ directory, then:.txt, .pdf, .csv, and .docx files.Step 5: BYOD as a web app
http://localhost:8861 with drag-and-drop file upload in the browser.What you just built
You now have a working civic AI application that:- Runs a GPT-4-class model locally for free
- Analyzes real civic datasets using RAG
- Provides a shareable web interface
- Works with any data you provide
Swap the data
Drop your own
.txt, .pdf, or .csv files into userdata/ and run Step 4Change the model
Try
ollama pull llama3.2:3b for faster responses or ollama pull deepseek-r1:7b for stronger reasoningMake it yours
Fork the repo, change the prompts, add new tracks, build a hackathon project on top of it
Get help
Every script supports
--help for full usage detailsUnderstanding the output
Each demo step shows you:| Output | Meaning |
|---|---|
12.3s | Time to generate the response |
142 tokens | Number of tokens generated |
11 tok/s | Generation speed (Apple Silicon: 15-25, CPU-only: 3-5) |
Local: $0.000009 | Actual electricity cost at 15W |
GPT-4o: $0.0017 | What the same query would cost on GPT-4o API |
189x more | Cost multiplier for cloud vs. local |
Try different models
Swap models to match your hardware:--model flag with any script:
Command-line options
All scripts support--help to see available options:
Common options
| Script | Options |
|---|---|
demo_step2_rag.py | <track> (eco/city/edu/justice), <question_num> (1-3), --all |
demo_step3_app.py | --port <port>, --share |
demo_step4_byod.py | <file_path>, --all, --model <model_name> |
demo_step5_byod_app.py | --port <port>, --model <model_name>, --share |
Troubleshooting
Ollama isn't responding
Ollama isn't responding
Check if Ollama is running:If not, start it:
The model is slow
The model is slow
- CPU inference for 8B models: expect 3-8 tokens/second (still fine for demos)
- Make sure no other heavy applications are competing for memory
- Try a smaller model:
ollama pull llama3.2:3b
Embedding model download is slow
Embedding model download is slow
The HuggingFace embedding model (
all-MiniLM-L6-v2) downloads on first use (~80 MB). Run Step 2 at least once to cache it before presenting.Gradio won't open in the browser
Gradio won't open in the browser
Try specifying the browser:Or open manually at
http://localhost:7860Next steps
Read the installation guide
Detailed setup instructions and hardware requirements
Understand the architecture
Learn how the RAG pipeline works
Explore the datasets
See what civic data is included
Customize your app
Change prompts, add tracks, and deploy