This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady
What I Built
Demo
Code
How I Built It
Why Does Open Innovation Matter?
My Agent Session
The Lazy Payoff
Prize Categories
You are a senior Python engineer helping me build a hackathon project in 1-2 days.
Project: LazyLecture
A local, offline tool that turns lecture files into study material automatically.
I drop a PDF (or audio file) into an "inbox" folder. A watcher detects it, a local
open-weight LLM processes it, and the output appears in an "output" folder:
- summary.md - a one-page summary with headings
- flashcards.md and flashcards.csv (Anki-importable: front,back)
- quiz.md - 5 multiple-choice questions with answers and one-line explanations
Hard constraints
- Everything runs locally and offline. No paid or cloud APIs.
- LLM via Ollama (default model: qwen2.5:7b; model name must be a config setting so I can swap in llama3.1:8b or a 3B model and compare).
- Python 3.11+, libraries: watchdog, pypdf, requests (or the ollama python client), pyyaml. Optional: whisper.cpp for audio transcription.
- Must work on Windows, macOS and Linux (use pathlib, no shell-specific code).
- Keep it simple: no frameworks beyond what's listed, minimal files, readable code.
Architecture
- config.yaml: model name, inbox/output paths, chunk size, number of flashcards/questions
- extract.py: PDF -> clean text (handle empty or scanned pages gracefully)
- chunk.py: split text into chunks that fit the model's context window
- llm.py: wrapper around Ollama with retries and timeouts
- pipeline.py: chunk -> summarize each chunk -> merge into final summary -> generate flashcards -> generate quiz. Ask the model for JSON for flashcards/quiz, validate it, and retry once if the JSON is malformed.
- watcher.py: watchdog loop that processes new files, waits until the file has finished copying, and skips files already processed.
- main.py: CLI entry point (
python main.py watchandpython main.py run <file>) - Optional stretch: app.py, a small Streamlit page to take the quiz and track wrong answers.
How to work
- First, show me the plan and file tree in under 15 lines. Wait for my OK.
- Build in small steps: (a) extract + chunk, (b) LLM wrapper, (c) pipeline, (d) watcher, (e) outputs. After each step, tell me exactly how to run and test it.
- Write a few pytest tests for chunking and JSON validation, with the LLM mocked.
- Log clearly (which file, which stage, time taken per stage). I want timing data for my write-up.
- Add a benchmark script that runs the same PDF through two different models and prints time taken and output length, so I can compare speed vs. quality.
- Finish with a README: what it does, setup steps (install Ollama, pull model, pip install), usage, a "why open-source/local matters" section, and troubleshooting.
Quality bar
- A new user can go from clone to working output in under 10 minutes.
- Errors never crash the watcher; they are logged and the file is moved to a "failed" folder.
- Explain any non-obvious decision in one sentence. Don't add features I didn't ask for.
Start with step 1 (the plan).
Top comments (0)