Inspiration
The inspiration came from the "Information Overload" era. Students and professionals are constantly bombarded with long PDFs, research papers, and complex web articles. We realized that passive reading is inefficient; the best way to retain knowledge is through active recall. We wanted to build a bridge between massive data sources and interactive learning, making it effortless for anyone to transform any document into a personalized self-assessment tool in seconds.
What it does
The Baidu AI Quiz Generator is an intelligent educational platform with following features:
- Ingests Multi-Format Data: Accepts local PDF/TXT uploads or live website URLs.
- Contextual Intelligence: Uses Baidu's ERNIE models to "read" and comprehend the material.
- Customizable Assessments: Allows users to choose the number of questions and the difficulty level (Easy, Medium, Hard) to match their learning stage.
- Interactive Learning: Provides a sleek Markdown interface where students can test themselves and reveal explanations for instant feedback.
- Portable Content: Supports exporting generated quizzes to CSV (for Excel) or Text files for offline study.
How we built it
The project was built using a modern AI-native stack:
- Frontend/UI: Gradio was used to create a responsive, web-based interface with dynamic components like progress loaders and interactive markdown.
- Brain/LLM: Integrated Baidu AI Studio via the OpenAI Python SDK. We leveraged the ernie-4.5-turbo-vl models for quiz generation.
- Text Processing: PyPDF for robust extraction of text from complex PDF structures.
- BeautifulSoup4 for cleaning and scraping relevant content from web URLs.
- Data Pipeline: Developed a custom Python backend that handles state management, progress tracking, and secure environment variable handling for API tokens.
Challenges we ran into
- JSON Parsing Robustness: LLMs occasionally wrap JSON in markdown blocks or include conversational filler. We had to implement a regex-based "cleaning" layer to ensure the app didn't crash when generating CSVs.
- Prompt Engineering for Difficulty: Defining what "Hard" means to an AI was tricky. We solved this by creating a "Difficulty Guideline" system prompt that forces the model to move from simple recall to Bloom’s Taxonomy-based analysis.
- Asynchronous UX: Initially, the UI froze during long API calls. We implemented Gradio's .queue() and gr.Progress() systems to provide real-time status updates, ensuring a smooth user experience.
- URL Cleaning: Extracting text from websites often included unwanted navigation menus and footers. We built a specific extraction logic to target only the main content tags.
Accomplishments that we're proud of
- Zero-Config Learning: We successfully made a tool where a student can go from a 20-page PDF to a 10-question quiz in under 15 seconds.
- Baidu Integration: Successfully implementing the Baidu AI Studio endpoint using an OpenAI-compatible workflow, proving the versatility of the model for educational tasks.
- Interactive UX: The "Show Answer" toggle feature in Markdown allows for a truly interactive "flashcard" experience right inside the browser.
What we learned
- Prompt Specificity: We learned that being "strict" with the AI (e.g., "Return ONLY JSON") is better than being "polite" when building automated pipelines.
- Progress Feedback Matters: In AI apps, the difference between a 10-second wait with a progress bar and a 10-second wait with a frozen screen is the difference between a user staying or leaving.
- Model Nuance: Different models within the Baidu ecosystem have different "personalities" regarding how they handle educational content.
What's next for Baidu AI Quiz Generator
- Multi-Modal Inputs: Extending the tool to accept video URLs (using Baidu’s Video Understanding) to generate quizzes from lectures.
- User Accounts: Allowing students to save their history and track their performance over time.
- Language Support: Enhancing the prompt logic to support seamless quiz generation in different languages
Built With
- ernie
- gradio
- python
Log in or sign up for Devpost to join the conversation.