跳到正文
DEV Community· NIDHAN JAIN·· 4 小時前AI 評分45

ClassSloth:以本機 Gemma 規劃每週功課

ClassSloth: a local Gemma planner for the week's homework

AI 導讀

ClassSloth 使用本機 Gemma 3 4B 規劃功課,並在儀錶板列出下一項任務。Google Classroom 為可選的唯讀連接,提供課程、功課、教材及學生提交狀態;程式不會建立、評分或提交功課。計劃和筆記留在本機,不會呼叫雲端模型或收集分析數據;首次同步 Classroom 需要網絡,其後可離線查看快取功課和已儲存筆記。

正文

This is my submission for the Hacktoberfest Open-Source AI Challenge: Week 3, Slow and Steady. ClassSloth is a new project built for this round.

What I built

ClassSloth answers the four questions I otherwise answer by opening every Classroom tab: what is due, what to do first, where the material is, and how to revise from notes I already have.

The lazy payoff is the tab-checking. The dashboard puts one next task on the screen. Due dates, titles, and links come from Classroom or from a clearly labeled demo set. If the app cannot tell whether something was turned in, the status stays unknown. Gemma's priorities and session lengths are estimates, and the source due date stays on the assignment.

Demo

About 63 seconds, recorded from the running app. It uses the labeled demo week, a saved Gemma plan, course links, and a local Ollama check. The file in the repository is docs/demo.webm.

Watch the demo

Code

How I built it

Python, Streamlit, SQLite, PyMuPDF, and Ollama. The default model is Gemma 3 4B (gemma3:4b). Google Classroom is optional and read-only: courses, published coursework, course materials, and the student's own submission state. The app does not create, grade, or turn in work.

flowchart LR
    Student[Student] --> UI[Streamlit]
    UI --> DB[(SQLite on this computer)]
    UI -->|Only when you click plan, match, or revise| Gemma[Ollama + Gemma 3 4B]
    Classroom[Google Classroom read-only] -->|Sync needs internet| DB
    Notes[Uploaded PDF or text] --> DB
    Gemma -->|Validated JSON| UI

Inference runs only when you ask for a plan, a note match, a revision pack, or a search summary. A Streamlit rerun does not call the model again. Assignment text and uploaded notes are wrapped as data, not instructions.

Gemma 3 4B will sometimes return a valid plan shape with an empty items list and the real work sitting in study_sessions. ClassSloth keeps those session notes as the steps and still shows the due date from SQLite. Unknown page numbers are dropped. That matches what builders report about small local models and structured JSON: the schema helps, and you still validate. See Ollama structured outputs with Pydantic and this local Ollama plus SQLite dashboard, which keeps a non-model path when the model is down.

The test suite does not need Google, SerpApi, or ElevenLabs credentials. The last run here was 41 passed.

git clone https://github.com/Dev-Nidhan/classsloth.git
cd classsloth
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
Copy-Item .env.example .env
ollama pull gemma3:4b
streamlit run app.py

With no OAuth client, choose Load demo week. Every synthetic title starts with Demo:.

Why open innovation matters

Coursework and notes are personal. The plan, the PDF text, and the revision pack stay on the machine and go to a local open-weight model. There is no cloud model call and no analytics. A first Classroom sync needs the internet. After that, cached assignments and saved notes open offline. A new sync does not.

Running Gemma locally also means the weekly plan does not depend on a per-token API bill. It does depend on the laptop. On this machine a plan came back in well under a minute, and one run omitted the per-assignment steps until the validator repaired them from the session notes Gemma did return.

Prize categories

  • Overall, Hacktoberfest Open-Source AI Challenge: Week 3, Slow and Steady.
  • Best Use of Gemma. Gemma 3 4B is the planner, the note matcher, and the exam-pack writer. The recorded demo shows a saved plan and gemma3:4b is installed.
  • Best Use of SerpApi. A topic search keeps the titles, URLs, and snippets SerpApi actually returned, prefers known educational hosts, and asks Gemma to order only those URLs. Invented links are dropped. It runs only from a button and needs SERPAPI_API_KEY. The recorded demo uses local notes, not a live search.
  • Best Use of ElevenLabs. Exam Prep speaks a passage you select, after a checkbox that says the text leaves the computer. Passages over 2,500 characters are refused before any request. It needs ELEVENLABS_API_KEY. Plans and notes work without audio.

I am not entering Best Use of GitHub Copilot, Render, or a .tech domain. Those are not part of this project.

來源:DEV Community · dev.to