Spaces:
Runtime error
Runtime error
Add requirements
Browse files- README.md +135 -9
- requirements.txt +5 -0
README.md
CHANGED
|
@@ -1,17 +1,143 @@
|
|
| 1 |
---
|
| 2 |
-
title: Worked Example Weaver
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.42.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
|
| 11 |
-
hf_oauth_scopes:
|
| 12 |
-
- inference-api
|
| 13 |
-
license: mit
|
| 14 |
-
short_description: Gradio UI for worked-example-weaver
|
| 15 |
---
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Worked Example Weaver
|
| 3 |
+
emoji: π§΅
|
| 4 |
+
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.42.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: cc0-1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# π§΅ Worked Example Weaver
|
| 14 |
+
|
| 15 |
+
**Personalized Learning Through Cognitive Load Theory**
|
| 16 |
+
|
| 17 |
+
An AI-powered web application that generates personalized worked examples tailored to individual learners' interests, goals, and contexts. Built on research-backed principles from Cognitive Load Theory.
|
| 18 |
+
|
| 19 |
+
## What is this?
|
| 20 |
+
|
| 21 |
+
This tool demonstrates two key learning science principles:
|
| 22 |
+
|
| 23 |
+
### The Worked Example Effect
|
| 24 |
+
> "Novice learners who study worked examples perform better than learners who solve problems independently."
|
| 25 |
+
> β NSW Centre for Education Statistics and Evaluation (2017)
|
| 26 |
+
|
| 27 |
+
**Why?** Unguided problem-solving overloads working memory. Worked examples reduce cognitive load, freeing capacity for learning.
|
| 28 |
+
|
| 29 |
+
### The Personalization Effect
|
| 30 |
+
|
| 31 |
+
Familiar contexts (your hobbies, interests, goals) are easier to process, further reducing cognitive load and improving learning outcomes.
|
| 32 |
+
|
| 33 |
+
## Features
|
| 34 |
+
|
| 35 |
+
- π― **Three Learning Domains**: Programming (Python), Health Sciences (Statistics), Agronomy
|
| 36 |
+
- π **16 Total Concepts**: 5-6 concepts per domain with varying difficulty levels
|
| 37 |
+
- π€ **AI-Powered Personalization**: Uses OpenAI GPT-5.1 with structured outputs
|
| 38 |
+
- π¨ **Clean Web Interface**: Built with Gradio for easy interaction
|
| 39 |
+
|
| 40 |
+
## How to Use
|
| 41 |
+
|
| 42 |
+
1. **Fill in your profile**
|
| 43 |
+
- Name, domain, interests, hobbies, goals, skill level
|
| 44 |
+
|
| 45 |
+
2. **Select a concept**
|
| 46 |
+
- Choose from domain-specific concepts based on your learning domain
|
| 47 |
+
|
| 48 |
+
3. **Generate your example**
|
| 49 |
+
- Click the generate button and wait 30-60 seconds
|
| 50 |
+
|
| 51 |
+
4. **Study the worked example**
|
| 52 |
+
- Examine the complete solution step-by-step
|
| 53 |
+
- See how it connects to your personal goals
|
| 54 |
+
|
| 55 |
+
## Supported Domains
|
| 56 |
+
|
| 57 |
+
### π Programming (Python)
|
| 58 |
+
- For loops
|
| 59 |
+
- List comprehensions
|
| 60 |
+
- Dictionary methods
|
| 61 |
+
- Functions with parameters
|
| 62 |
+
- String formatting
|
| 63 |
+
|
| 64 |
+
**Example contexts**: Recipe websites, photography portfolios, gaming tools
|
| 65 |
+
|
| 66 |
+
### π₯ Health Sciences (Statistics)
|
| 67 |
+
- Mean and standard deviation
|
| 68 |
+
- Correlation analysis
|
| 69 |
+
- Linear regression
|
| 70 |
+
- Independent t-tests
|
| 71 |
+
- Confidence intervals
|
| 72 |
+
- Effect size (Cohen's d)
|
| 73 |
+
|
| 74 |
+
**Example contexts**: Sports performance, nutrition tracking, patient outcomes
|
| 75 |
+
|
| 76 |
+
### πΎ Agronomy (Agricultural Science)
|
| 77 |
+
- Yield prediction
|
| 78 |
+
- NPK optimization
|
| 79 |
+
- Growing degree days
|
| 80 |
+
- Water use efficiency
|
| 81 |
+
- Cost-benefit analysis
|
| 82 |
+
|
| 83 |
+
**Example contexts**: Family farms, specific crops, sustainable agriculture
|
| 84 |
+
|
| 85 |
+
## Technical Stack
|
| 86 |
+
|
| 87 |
+
- **[Gradio](https://gradio.app)**: Modern web interface for ML applications
|
| 88 |
+
- **[PydanticAI](https://ai.pydantic.dev)**: Type-safe AI agent framework
|
| 89 |
+
- **[OpenAI GPT-5.1](https://openai.com)**: Language model for generation
|
| 90 |
+
- **[Pydantic](https://pydantic.dev)**: Data validation using Python type hints
|
| 91 |
+
|
| 92 |
+
## Research Foundations
|
| 93 |
+
|
| 94 |
+
This tool implements evidence-based learning principles:
|
| 95 |
+
|
| 96 |
+
**Cooper, G., & Sweller, J. (1987)**. Effects of schema acquisition and rule automation on mathematical problem-solving transfer. *Journal of Educational Psychology*, 79(4), 347-362.
|
| 97 |
+
|
| 98 |
+
**Cordova, D. I., & Lepper, M. R. (1996)**. Intrinsic motivation and the process of learning: Beneficial effects of contextualization, personalization, and choice. *Journal of Educational Psychology*, 88(4), 715.
|
| 99 |
+
|
| 100 |
+
**NSW Centre for Education Statistics and Evaluation (2017)**. *Cognitive load theory: Research that teachers really need to understand*. [Link](https://education.nsw.gov.au/about-us/education-data-and-research/cese/publications/literature-reviews/cognitive-load-theory)
|
| 101 |
+
|
| 102 |
+
**Sweller, J. (1988)**. Cognitive load during problem solving: Effects on learning. *Cognitive Science*, 12(2), 257-285.
|
| 103 |
+
|
| 104 |
+
## Extend This Tool
|
| 105 |
+
|
| 106 |
+
Ideas for enhancement:
|
| 107 |
+
|
| 108 |
+
- Add more domains (economics, chemistry, history, literature)
|
| 109 |
+
- Include images and diagrams in examples
|
| 110 |
+
- Create sequences of scaffolded examples
|
| 111 |
+
- Track learner progress over time
|
| 112 |
+
- Export examples to PDF or flashcards
|
| 113 |
+
- Add multilingual support
|
| 114 |
+
- Integrate with learning management systems
|
| 115 |
+
|
| 116 |
+
## About
|
| 117 |
+
|
| 118 |
+
Created by the [Virtual Academy](https://virtuelleakademie.ch/) at Bern University of Applied Sciences as part of the workshop "Building Personalized Worked Example Generators with AI."
|
| 119 |
+
|
| 120 |
+
**Instructor**: [Dr. Andrew Ellis](mailto:andrew.ellis@bfh.ch), Cognitive Psychologist
|
| 121 |
+
|
| 122 |
+
**Workshop Materials**: [ki-lehre-advanced](https://virtuelleakademie.github.io/ki-lehre-advanced/)
|
| 123 |
+
|
| 124 |
+
## License
|
| 125 |
+
|
| 126 |
+
CC0 1.0 Universal - Public Domain
|
| 127 |
+
|
| 128 |
+
---
|
| 129 |
+
|
| 130 |
+
## Local Development
|
| 131 |
+
|
| 132 |
+
```bash
|
| 133 |
+
# Clone and install
|
| 134 |
+
git clone <repo>
|
| 135 |
+
cd worked-example-weaver-app
|
| 136 |
+
pip install -r requirements.txt
|
| 137 |
+
|
| 138 |
+
# Set OpenAI API key
|
| 139 |
+
export OPENAI_API_KEY="sk-your-key-here"
|
| 140 |
+
|
| 141 |
+
# Run locally
|
| 142 |
+
python app.py
|
| 143 |
+
```
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
pydantic>=2.12.4
|
| 3 |
+
pydantic-ai>=0.0.13
|
| 4 |
+
openai
|
| 5 |
+
python-dotenv>=1.2.1
|