DEV Community

Naman Dhakad
Naman Dhakad

Posted on

๐Ÿš€ From Paper to Pixels: How I Built an AI-Powered Exam Platform with Google Gemini

Transforming PDF question papers into interactive CBT experiences - a journey through hackathons, AI, and building for millions of students

The Spark โœจ

It was 2 AM in the hostel room. My friend was frustratedโ€”again. He'd solved a 180-question JEE mock test on paper, only to realize he'd made a calculation error on question #45 that threw off his entire ranking. No instant results. No analytics. No way to know his weak areas.

"If only there was a way to just... upload the PDF and take it like the real exam."

That question changed everything.


๐ŸŽฏ What I Built: Rankify

Rankify is an AI-powered platform that transforms any PDF question paper into a fully interactive computer-based test (CBT). No more paper. No more manual checking. Just upload, practice, and analyze.

The Magic Flow โœจ

graph LR
    A[๐Ÿ“„ PDF Upload] --> B[๐Ÿค– AI Extraction]
    B --> C[๐Ÿ‘๏ธ Review & Edit]
    C --> D[โš™๏ธ Configure Test]
    D --> E[๐ŸŽฎ Take the Test]
    E --> F[๐Ÿ“Š Analyze Results]
Enter fullscreen mode Exit fullscreen mode

Features That Actually Matter ๐ŸŽฎ

Feature What It Does Why It Matters
AI Extraction Gemini reads your PDF and extracts questions No manual typing
Confidence Scores Each question gets a 1-5 confidence rating Know what to review
Diagram Detection AI finds and maps diagrams to questions Visual questions handled
Multi-PDF Batch Process 10 PDFs at once Save time
Offline Mode Works without internet Study anywhere

๐Ÿง  The Hackathon Journey

This wasn't a weekend project. It started at an MLH hackathon where I had 24 hours to prove the concept worked.

Day 1: The Chaos ๐ŸŒช๏ธ

Me at 6 PM: "I'll use Gemini to extract questions from PDFs!"
Me at 8 PM: *Reading Gemini documentation*
Me at 10 PM: *Making API calls that fail*
Me at midnight: *First successful extraction! ๐ŸŽ‰*
Me at 2 AM: *It works but the JSON is garbage*
Enter fullscreen mode Exit fullscreen mode

Day 2: The Pivot ๐Ÿ”„

I realized the hard way: JSON output from LLMs is unpredictable. So I built:

  1. Zero-tolerance prompts - Instructions so strict Gemini had no choice but to behave
  2. Fallback chains - If one model fails, automatically try the next
  3. Confidence scoring - A multi-factor algorithm to rate extraction quality
// The fallback chain that saved my hackathon
const modelFallback = [
  'gemini-2.5-flash',      // Best quality
  'gemini-2.5-flash-lite', // Quality + speed  
  'gemini-2.0-flash',      // Reliable backup
  'gemini-2.0-flash-lite'  // Last resort
]
Enter fullscreen mode Exit fullscreen mode

The Result? ๐Ÿ†

A working prototype that extracted 85 questions from a JEE sample paper in 3 minutes. Not perfectโ€”but proof it was possible.


๐Ÿ”ฅ What I Learned

Technical Wins ๐Ÿ’ป

  1. Gemini's Vision API is underutilized

    Most people use it for images. But PDFs? That's where the magic happens for educational tech.

  2. Prompt engineering > Fine-tuning

    I spent zero dollars on training. Just better prompts.

  3. Client-side AI is viable

    Privacy-first architecture actually became a selling point.

The Hard Lessons ๐Ÿ˜ต

Problem Solution
Rate limits Implemented exponential backoff + model fallback
PDF parsing issues Added pdf.js preprocessing
JSON hallucinations Built a validation layer with confidence scores
Cost tracking Created real-time usage dashboard

Soft Skills That Stuck ๐ŸŽฏ

  • MVP-first thinking: Ship fast, iterate faster
  • User empathy: Students don't care about AIโ€”they care about results
  • Failure tolerance: 70% of my experiments failed. That's okay.

๐Ÿ“ My Google Gemini Feedback: The Good, The Bad, The Ugly

โœ… What Worked Brilliantly

  • Multi-modal = Game changer ๐ŸŽจ
    Processing text + images together meant diagrams weren't a separate problem.

  • Context caching ๐Ÿ’พ
    Reduced costs by 60%. Essential for production apps.

  • Large context windows ๐Ÿ“
    1M tokens = entire question papers in one go. Unreal.

  • JSON mode ๐Ÿ“‹
    Structured output without post-processing. So good.

โš ๏ธ Where Google Could Improve

  • PDF parsing is inconsistent
    Rotated pages, watermarks, and scanned docs still cause headaches.

  • Rate limits are tight
    For a free tier, it's restrictive. I had to build a queuing system.

  • Error messages are cryptic
    "Internal error" tells me nothing. Help us help you!

  • Cost visibility
    Real-time spend tracking would prevent surprises.

๐Ÿ˜ฌ The Ugly Truth

Sometimes Gemini hallucinates. It sees a question it can't parse and just... makes up options. That's why confidence scoring exists now.


๐Ÿš€ Where I'm Going Next

The journey continues:

Phase 1: Cloud Run Deployment

gcloud run deploy rankify-ai \
  --source . \
  --region us-central1 \
  --no-allow-unauthenticated \
  --labels dev-tutorial=blog-devcommunity2026
Enter fullscreen mode Exit fullscreen mode

Phase 2: Agent Development Kit (ADK)

Building specialized agents for different subjects:

  • Physics Agent ๐Ÿงช
  • Chemistry Agent โš—๏ธ
  • Math Agent ๐Ÿ“

Phase 3: A2A Protocol

Agent-to-agent communication for complex multi-step reasoning


๐Ÿ’ก To Anyone Building with Gemini

  1. Start with Vision - It's more mature than you think
  2. Build for failure - Every API call can fail
  3. Hide the AI - Users want results, not technology
  4. Trust but verify - Confidence scores are your friend

๐ŸŽค Final Thoughts

Building Rankify taught me that AI isn't about replacing humansโ€”it's about amplifying. A what we can do student in a small town with a cracked phone can now practice with the same quality as someone with expensive coaching.

That's what keeps me building.


Thanks for reading! If you want to try Rankify, check out the live demo. And if you're entering the Built with Google Gemini: Writing Challengeโ€”good luck! ๐ŸŽ‰


MLH #DEVChallenge #GoogleGemini #Vue #Nuxt #AI #WebDev

Top comments (0)