--- title: LearnCraft emoji: π colorFrom: blue colorTo: purple sdk: streamlit sdk_version: 1.32.0 app_file: app.py pinned: true license: mit short_description: Personalized AI Learning Platform tags: - education - learning - ai-tutor - quiz - flashcards - groq - llama - streamlit - gamification - study-tools --- # π LearnCraft β Personalized AI Learning Platform > Generate personalized study material, flashcards & quizzes tailored exactly to your level and learning goals β powered by **Groq LLaMA-3.3-70b**.     --- ## π What is LearnCraft? LearnCraft is a fully AI-powered learning platform that generates **customized study content** based on your chosen topic and difficulty level. Whether you're a beginner learning Python or an advanced student studying Quantum Mechanics β LearnCraft adapts everything to you. ### How it works: 1. **Pick a topic** β anything from Calculus to Climate Change 2. **Choose your level** β Beginner, Intermediate, or Advanced 3. **Get personalized content** β notes, quizzes, flashcards and an AI tutor instantly 4. **Track your progress** β earn XP, unlock badges and monitor your scores --- ## β¨ Features | Feature | Description | |---|---| | π **Study Content Generator** | AI-generated notes in 4 styles: Summary Notes, Detailed Explanation, Bullet Points, Concept Map | | π **Flashcard Studio** | Auto-generated flip-card decks (up to 20 cards) for any topic | | π§© **Quiz Engine** | MCQ, True/False, Fill-in-the-Blank, Short Answer β with optional timed mode | | π€ **AI Tutor Chat** | Multi-turn conversational AI tutor with topic context and full conversation memory | | π **Gamification** | XP points, 7 levels (Seedling β Genius), 15 badges, daily streak tracking | | π **PDF Export** | Download study notes and quiz results as branded A4 PDFs | | π **Progress Dashboard** | Score history chart, per-topic best scores, weak topic detection | | π **Notes** | Save, search and delete personal notes during study sessions | --- ## π Running on Hugging Face Spaces This app runs directly on Hugging Face Spaces using the **Streamlit SDK**. ### βοΈ Required Secret You must add your **Groq API key** as a Space secret for the app to work: 1. Go to your Space β **Settings** β **Repository secrets** 2. Add a new secret: - **Name:** `GROQ_API_KEY` - **Value:** your Groq API key from [console.groq.com](https://console.groq.com) > Get a free Groq API key at **https://console.groq.com** β it takes under a minute. ### π Files required in your Space ``` app.py content_generator.py quiz_generator.py flashcard_generator.py tutor.py evaluation.py gamification.py pdf_export.py utils.py requirements.txt README.md ``` --- ## π API Key Configuration The app reads the Groq API key from the environment. Make sure each module uses: ```python import os GROQ_API_KEY = os.environ.get("GROQ_API_KEY", "") ``` > If you're running **locally**, set the variable in your terminal: > ```bash > export GROQ_API_KEY="gsk_your_key_here" # macOS/Linux > set GROQ_API_KEY=gsk_your_key_here # Windows > ``` --- ## π¦ Requirements ``` streamlit>=1.32.0 pandas>=2.0.0 groq>=0.4.0 reportlab>=4.0.0 plotly>=5.18.0 ``` --- ## πΊοΈ App Pages | Page | Description | |---|---| | π **Home** | Hero banner, feature overview, quick-start buttons, recent activity feed | | π **Study Content** | Generate AI study notes with key terms, summary and PDF export | | π **Flashcards** | Navigate AI-generated flip cards with progress bar and deck overview | | π§© **Take Quiz** | Timed quiz with instant results, XP awards and PDF download | | π€ **AI Tutor** | Chat with an AI tutor β quick-start prompts and topic context | | π **Achievements** | XP level hero card, badge gallery, streak and stats | | π **My Progress** | Score history, per-topic performance table, weak topic alerts | | π **My Notes** | Searchable saved notes from study sessions | --- ## π Gamification ### Earn XP for every learning action: | Action | XP | |---|---| | Study session | +10 XP | | Flashcard deck | +10 XP | | Complete a quiz | +20 XP | | Score β₯ 60% | +15 XP | | Score β₯ 80% | +30 XP | | Perfect score (100%) | +50 XP | ### 7 Levels: ``` π± Seedling (0 XP) β π Reader (50) β π Student (150) β π¬ Scholar (300) β π Expert (500) β π Master (800) β π Genius (1200) ``` ### 15 Badges to unlock: | Badge | How to Earn | |---|---| | π― First Quiz | Complete your first quiz | | π― Perfect Score | Score 100% on a quiz | | π₯ 3-Day Streak | Study 3 days in a row | | β‘ Week Warrior | Study 7 days in a row | | ποΈ Fortnight Hero | Study 14 days in a row | | πΊοΈ Explorer | Study 5 different topics | | π§ Polymath | Study 10 different topics | | π§© Quiz Master | Complete 10 quizzes | | π Quiz Champion | Complete 25 quizzes | | π High Achiever | Score above 80% | | π Card Shark | Complete a flashcard deck | | π¬ Scholar | Reach Scholar level (300 XP) | | π Expert | Reach Expert level (500 XP) | | π Master | Reach Master level (800 XP) | | π Note Taker | Save your first note | --- ## π Architecture ``` User (Browser) β βΌ app.py (Streamlit β routing, session state, UI) β βββ content_generator.py βββ βββ quiz_generator.py ββββΊ Groq API (LLaMA-3.3-70b) βββ flashcard_generator.py β βββ tutor.py ββββ β βββ evaluation.py ββ Quiz answer scoring βββ gamification.py ββ XP / badges / streak βββ pdf_export.py ββ ReportLab PDF generation βββ utils.py ββ JSON persistence (learning_progress.json, notes.json, gamification.json) ``` --- ## π‘ Topics You Can Study LearnCraft works with **any topic you type**, plus these built-in suggestions: `Photosynthesis` Β· `Machine Learning` Β· `World War II` Β· `Python Functions` Β· `Calculus` Β· `Climate Change` Β· `The French Revolution` Β· `DNA Replication` Β· `Object-Oriented Programming` Β· `The Solar System` Β· `Economics Supply & Demand` Β· `Quantum Mechanics` --- ## π Data & Privacy - All progress, notes and gamification data are stored in **local JSON files** within the Space - No user data is sent anywhere except to the **Groq API** for content generation - The Groq API is used solely for generating educational content - On Hugging Face Spaces, persistent storage resets when the Space restarts β data is session-local --- ## π οΈ Local Development ```bash # 1. Clone the Space git clone https://huggingface.co/spaces/YOUR_USERNAME/learncraft cd learncraft # 2. Install dependencies pip install -r requirements.txt # 3. Set your API key export GROQ_API_KEY="gsk_your_key_here" # 4. Run streamlit run app.py ``` --- ## π License MIT License β free to use, modify and distribute. ---