File size: 8,898 Bytes
0b67ab6
 
 
 
 
 
 
 
 
 
 
 
 
 
3914a3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
252
253
254
255
256
257
258
259
260
261
---
title: EDUTUTOR AI
emoji: 🌍
colorFrom: pink
colorTo: yellow
sdk: gradio
sdk_version: 5.34.2
app_file: app.py
pinned: false
license: apache-2.0
short_description: "EduTutor AI application\_files"
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# πŸŽ“ EduTutor AI - Complete Learning Platform

**An advanced AI-powered educational platform that provides personalized tutoring, homework analysis, interactive quizzes, and comprehensive progress tracking.**

## ✨ Features

### πŸ€– AI Chat Tutor
- **Intelligent Responses**: Powered by IBM Granite 3.3 2B Instruct model with GPT-2 fallback
- **Multi-Subject Support**: Mathematics, Physics, Chemistry, Biology, and General topics
- **Difficulty Levels**: Beginner, Intermediate, and Advanced content
- **Math Problem Solving**: Automatic detection and step-by-step solutions for algebraic equations

### πŸ“Š Advanced Homework Analyzer
- **Multi-Problem Detection**: Automatically identifies and separates individual problems
- **Comprehensive Solutions**: Detailed step-by-step solutions with explanations
- **Subject-Specific Analysis**: Tailored approaches for different academic subjects
- **Performance Assessment**: Grading estimates and improvement recommendations

### πŸ“ Interactive Quiz System
- **Dynamic Question Generation**: Creates subject-specific quizzes on any topic
- **Immediate Feedback**: Detailed explanations for each answer
- **Performance Tracking**: Automatic score calculation and analysis
- **Customizable Length**: 3-10 questions per quiz

### πŸ“‹ Study Plan Generator
- **Personalized Learning Paths**: Custom study plans based on topic and duration
- **Structured Modules**: Organized learning with time estimates and difficulty levels
- **Essential Terminology**: Key terms and definitions for each subject
- **Progress Milestones**: Clear goals and assessment points

### πŸ“ˆ Progress Tracking
- **Comprehensive Analytics**: Detailed performance reports and trends
- **Multi-Student Support**: Track progress for multiple learners
- **Achievement System**: Badges and milestones for motivation
- **Learning Insights**: Personalized recommendations based on performance data

## πŸš€ Quick Start

### Prerequisites
- Python 3.8 or higher
- CUDA-compatible GPU (optional, for better performance)
- Hugging Face account (optional, for access to more models)

### Installation

1. **Clone or download the application files**
   \`\`\`bash
   # Ensure you have app.py in your working directory
   \`\`\`

2. **Install dependencies**
   \`\`\`bash
   pip install -r requirements.txt
   \`\`\`

3. **Set up Hugging Face token (optional)**
   - Create a Hugging Face account at https://huggingface.co
   - Generate an access token
   - Set it as an environment variable or add to Google Colab secrets:
   \`\`\`bash
   export HF_TOKEN="your_token_here"
   \`\`\`

4. **Run the application**
   \`\`\`bash
   python app.py
   \`\`\`

5. **Access the web interface**
   - Open your browser and go to `http://localhost:7860`
   - The application will also provide a public Gradio link for sharing

## 🎯 How to Use

### AI Chat Tutor
1. Select your subject and difficulty level
2. Type your question in the chat input
3. Get instant, detailed responses with explanations
4. Ask follow-up questions for deeper understanding

**Example Questions:**
- "Solve 2x + 5 = 15"
- "What is photosynthesis?"
- "Explain Newton's first law"
- "How do I factor xΒ² - 5x + 6?"

### Homework Analyzer
1. Select the subject of your homework
2. Paste your homework problems in the text area
3. Click "Analyze Homework" for comprehensive solutions
4. Review detailed explanations and study recommendations

### Interactive Quizzes
1. Enter a topic and select subject
2. Choose the number of questions (3-10)
3. Answer all questions using the radio buttons
4. Submit to see results with explanations

### Study Plans
1. Enter the topic you want to study
2. Select subject and study duration
3. Get a personalized learning roadmap with:
   - Structured modules and timelines
   - Key concepts and terminology
   - Study tips and resources

### Progress Tracking
1. **Add Progress**: Record completed activities with scores
2. **View Reports**: Generate comprehensive progress analytics
3. **Track Trends**: Monitor improvement over time
4. **Get Recommendations**: Receive personalized study advice

## 🧠 AI Models and Technology

### Primary Model
- **IBM Granite 3.3 2B Instruct**: Advanced language model optimized for educational content
- **Automatic Fallback**: GPT-2 model ensures reliability if primary model fails
- **GPU Acceleration**: CUDA support for faster response times

### Knowledge Base
- **Curated Content**: Expert-verified information across multiple subjects
- **Structured Learning**: Organized concepts with definitions and applications
- **Real-World Connections**: Practical applications and examples

### Math Solver
- **Algebraic Equations**: Step-by-step solutions with verification
- **Arithmetic Operations**: Order of operations and detailed calculations
- **Error Handling**: Helpful guidance when problems can't be solved automatically

## πŸ“š Supported Subjects

### Mathematics
- Algebra (linear equations, quadratics, systems)
- Geometry (shapes, area, volume)
- Calculus (derivatives, integrals, limits)
- Statistics (data analysis, probability)

### Physics
- Mechanics (motion, forces, energy)
- Thermodynamics (heat, temperature, entropy)
- Electromagnetism (electric and magnetic fields)
- Waves (sound, light, frequency)

### Chemistry
- Organic Chemistry (carbon compounds, reactions)
- Inorganic Chemistry (metals, salts, acids/bases)
- Chemical Bonding (ionic, covalent, molecular)

### Biology
- Cell Biology (organelles, processes)
- Genetics (DNA, inheritance, mutations)
- Photosynthesis and Respiration
- Ecology and Evolution

## πŸ”§ Configuration

### Environment Variables
- `HF_TOKEN`: Hugging Face API token for model access
- `CUDA_VISIBLE_DEVICES`: GPU selection for CUDA acceleration

### Model Configuration
The application automatically detects available hardware and configures models accordingly:
- **GPU Available**: Uses CUDA acceleration with float16 precision
- **CPU Only**: Falls back to CPU processing with float32 precision

## πŸ“Š Performance and Scalability

### System Requirements
- **Minimum**: 4GB RAM, 2GB storage
- **Recommended**: 8GB RAM, 4GB storage, CUDA-compatible GPU
- **Optimal**: 16GB RAM, 8GB storage, modern GPU (RTX 3060 or better)

### Response Times
- **With GPU**: 1-3 seconds for most queries
- **CPU Only**: 5-15 seconds depending on complexity
- **Simple Math**: Near-instantaneous regardless of hardware

## πŸ› οΈ Troubleshooting

### Common Issues

**Model Loading Fails**
- Check internet connection for model download
- Verify sufficient disk space (2-4GB required)
- Try running with CPU-only mode

**Slow Performance**
- Enable GPU acceleration if available
- Reduce concurrent users
- Consider using lighter models for deployment

**Quiz/Progress Features Not Working**
- Ensure all form fields are filled correctly
- Check that scores are between 0-100
- Verify student names don't contain special characters

### Getting Help
- Check the console output for detailed error messages
- Ensure all dependencies are installed correctly
- Try restarting the application if issues persist

## 🀝 Contributing

This educational platform is designed to be extensible and customizable:

### Adding New Subjects
1. Extend the `KnowledgeBase` class with new subject data
2. Add subject-specific question templates for quizzes
3. Update the Gradio interface dropdown options

### Improving AI Responses
1. Enhance the knowledge base with more detailed content
2. Add new prompt templates for different question types
3. Implement additional fallback response strategies

### Adding Features
1. Create new methods in the `EducationalFeatures` class
2. Add corresponding Gradio interface components
3. Update the main application class to integrate new features

## πŸ“„ License

This project is designed for educational purposes. Please ensure compliance with:
- Hugging Face model licenses
- Gradio usage terms
- Educational fair use guidelines

## πŸ™ Acknowledgments

- **Hugging Face**: For providing the transformer models and libraries
- **Gradio**: For the excellent web interface framework
- **IBM**: For the Granite model series
- **SymPy**: For mathematical computation capabilities
- **PyTorch**: For deep learning infrastructure

## πŸ“ž Support

For technical support or questions:
1. Check the troubleshooting section above
2. Review the console output for error details
3. Ensure all requirements are properly installed
4. Consider hardware limitations for performance issues

---

**EduTutor AI - Empowering Education Through Artificial Intelligence** πŸŽ“βœ¨