Spaces:
Sleeping
Sleeping
File size: 7,780 Bytes
9af8807 441f415 a5ce938 441f415 a5ce938 9af8807 441f415 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | ---
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.
---
<div align="center">
Built with β€οΈ using <strong>Streamlit</strong> Β· <strong>Groq</strong> Β· <strong>ReportLab</strong> Β· <strong>Python</strong>
<br><br>
<em>π LearnCraft β Learn smarter, not harder.</em>
</div>
|