DEV Community

Prachi B
Prachi B

Posted on

StudyLens NCERT Buddy

What I Built

So basically I have friends preparing for Neet Exam, which forces everyone to read and remember NCERT line by line, as anything could be asked. This exam requires patience and in depth understanding of every concept. I made this study tool, because I heard them say when I open NCERT its like so much info, not structured, and not exam oriented. Even I one day opened NCERT of psychology to read, it was like very boring and sometimes to understand we just need few points, no extra rambling around of words.

That is why I built this tool to help those who have some competitive exam which forces students to read NCERT. This reading should be exam oriented and that is what makes this solution stand out. I can get the actual PYQs right on my side. It also helps to reduce the toil of copy paste and putting on GPT writing a prompt then asking for the structured format of study suited for you.

Code

StudyLens

A study companion that lives next to your textbook PDF. Open a PDF, highlight the paragraph that's confusing you, right-click, and StudyLens turns it into notes shaped the way you like to study. It can also find real previous-year questions on that topic, write fresh practice questions, and answer doubts in a chat while you read.

It runs on Gemma (Google's open-weight model), either on your own computer through Ollama or through a Google AI Studio key.

Built for the Hacktoberfest Weekend Challenge: Build for a Friend.


What it does

Feature In one line
PDF reader Open any text-based PDF, scroll, zoom, jump to a page.
Right-click actions Select text → Explain / Study this, Find actual PYQs, Generate practice questions, Ask a doubt about this.
Study Profiles You choose which sections your notes have, in what order, plus exam, depth, language, and a
…

How I Built It

The core is Gemma 4, and the app can talk to it two ways: locally through Ollama (gemma4:e4b), or through a Google AI Studio key (gemma-4-26b-a4b-it). It's a plain React + Vite app with pdf.js for the reader and no backend at all.

The flow is simple: selected text → action → prompt builder → Gemma → side panel. The interesting part is that the prompt is built from data. A study structure is just JSON (an ordered list of enabled sections plus exam, depth and language), and the prompt builder turns it into instructions.

A few things I learned the hard way:

Asking for JSON was a mistake. My first version told Gemma to reply in JSON, then converted that into notes.I switched to having Gemma write the notes directly in Markdown, one ## Heading per section, and the panel shows it as it streams. A small checker only warns if Gemma ignored the structure. It never rewrites the notes.

The slowness wasn't where I thought. Some answers took over a minute. I assumed the model was writing too much. The console showed one run took 77.7 seconds to write 24 tokens. The wait was Google's hosted 31B model taking ages to start, or returning 500 errors, and my retries made it worse. The fix was boring and effective: one attempt with a 12 second deadline to the first word, then an instant switch to the lighter 26b-a4b model, remembering for a few minutes that the big one is struggling.

Real questions should be retrieved, not generated. The PYQ search is plain code: it weights words by how rare they are across the bank, scores each question by the words it shares with your selection, and filters to your exam. Nothing is generated, so nothing can be invented.

Doubts only need one page. Gemma 4's context window would not comfortably hold a whole textbook, and reading that much would be slow anyway. So each question sends the current page, the last few turns of chat and the student's study settings. It's fast, and the answers stay anchored to what they are actually reading.

Why Does Open Innovation Matter?

A student's textbooks, highlights and doubts are personal. With an open-weight model I can offer a version that runs entirely on their own laptop through Ollama: no account, no per-question cost, nothing leaving the machine.

My Agent Session

I built StudyLens with an AI assistant (Claude) writing and testing code alongside me, and I directed the product decisions: the study structures, keeping PYQs separate from AI-generated questions, and the latency fixes.

Prize Categories

Best Use of Gemma. Gemma 4 does the notes, the practice questions and the doubt chat, and it is served both locally through Ollama and through Google AI Studio.

Top comments (0)