quiz-solver / README.md
udaypratap's picture
Upload folder using huggingface_hub
d28d608 verified
|
Raw
History Blame Contribute Delete
3.45 kB
metadata
title: TDS Quiz Solver
emoji: 🧠
colorFrom: blue
colorTo: green
sdk: docker
pinned: false

TDS Quiz Solver - Automated Quiz-Solving System

Complete automated quiz-solving system for the TDS LLM Analysis challenge. This system receives quiz challenges via webhook, scrapes JavaScript-rendered web pages, processes files (PDF, CSV, Excel), analyzes data, and submits answers automatically.

πŸš€ Quick Start on Hugging Face Spaces

This Space provides a /solve endpoint that accepts quiz URLs and automatically solves them.

Required Environment Variables

Configure these in your Space Settings β†’ Variables & Secrets:

Variable Required Example Description
EMAIL βœ… Yes your.email@example.com Your registered email
SECRET βœ… Yes your_secret_key Your authentication secret
DISABLE_PLAYWRIGHT Optional 0 Set to 1 for Python Space (requests-only mode)
RATE_LIMIT_WINDOW Optional 300 Rate limit window in seconds
RATE_LIMIT_MAX Optional 40 Max requests per IP per window
ENABLE_SELF_PING Optional 0 Set to 1 to keep Space awake

API Endpoints

Health Check

curl https://USERNAME-quiz-solver.hf.space/

Solve Quiz

curl -X POST https://USERNAME-quiz-solver.hf.space/solve \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your.email@example.com",
    "secret": "your_secret_key",
    "url": "https://tds-llm-analysis.s-anand.net/demo"
  }'

System Info

curl https://USERNAME-quiz-solver.hf.space/info

🐳 Docker vs Python Space

Docker Space (Recommended)

  • βœ… Full Playwright browser support
  • βœ… Complete JavaScript rendering
  • βœ… Handles dynamic content
  • ⚠️ Slightly longer startup time

Python Space

  • βœ… Faster startup
  • ⚠️ Set DISABLE_PLAYWRIGHT=1
  • ⚠️ Limited to static HTML (requests-only)
  • ⚠️ May not handle complex JS-heavy pages

πŸ“Š Features

  • βœ… FastAPI webhook endpoint for quiz challenges
  • βœ… Playwright headless browser (Docker) or requests fallback (Python)
  • βœ… PDF, CSV, Excel file processing
  • βœ… Automated data analysis and answer generation
  • βœ… Quiz chain solving (multiple sequential quizzes)
  • βœ… Background task processing
  • βœ… Rate limiting to prevent abuse
  • βœ… Comprehensive error handling and logging
  • βœ… Chart generation for visualization questions

πŸ”§ Supported Question Types

  • Numeric: Sum, total, count, average, mean, median, max, min
  • Boolean: True/false, yes/no questions
  • Charts: Bar charts, line plots, scatter plots, histograms (Base64 PNG)
  • Complex: JSON objects with multiple values

πŸ“ Response Format

Success Response (202 Accepted)

{
  "status": "processing",
  "message": "Quiz solving started for URL: https://example.com/quiz"
}

Error Responses

  • 403 Forbidden: Invalid secret or email mismatch
  • 422 Unprocessable Entity: Invalid request format
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Server error

πŸ› οΈ Development

Full documentation, installation instructions, and development guide available in the GitHub repository.

πŸ“„ License

MIT License - See LICENSE file for details.


Built with: FastAPI β€’ Playwright β€’ pandas β€’ pdfplumber β€’ matplotlib