Kiki0203's picture
Upload README.md
441f415 verified
---
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**.
![Python](https://img.shields.io/badge/Python-3.9+-6C47FF?style=flat-square&logo=python&logoColor=white)
![Streamlit](https://img.shields.io/badge/Streamlit-1.32+-FF4B4B?style=flat-square&logo=streamlit&logoColor=white)
![Groq](https://img.shields.io/badge/Groq-LLaMA--3.3--70b-F97316?style=flat-square&logoColor=white)
![License](https://img.shields.io/badge/License-MIT-10B981?style=flat-square)
---
## 🌟 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>