--- title: BrightMind AI - Educational Content Generator emoji: ๐Ÿง  colorFrom: blue colorTo: purple sdk: gradio sdk_version: "4.44.1" app_file: app.py pinned: false license: mit short_description: AI-powered educational content generation platform --- # ๐Ÿง  BrightMind AI - Educational Content Generator [![Python](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://python.org) [![Gradio](https://img.shields.io/badge/Gradio-4.44.1+-green.svg)](https://gradio.app) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) An intelligent educational platform that generates comprehensive lesson plans, quizzes, and educational content using AI and proven educational algorithms. BrightMind AI empowers educators with intelligent tools to create engaging, grade-appropriate content across all subjects. ## โœจ Features ### ๐Ÿค– AI-Powered Content Generation - **Hugging Face Integration**: Uses state-of-the-art language models for enhanced content creation - **Intelligent Fallback**: Educational algorithms ensure content generation even without API access - **Context-Aware**: Adapts content based on subject, grade level, and difficulty ### ๐Ÿ“š Educational Content Types - **Lesson Plans**: Comprehensive, structured lesson plans with objectives, activities, and assessments - **Quizzes**: Custom quizzes with multiple question types (Multiple Choice, True/False, Short Answer, Fill-in-the-Blank) - **Worksheets**: Interactive educational materials with visual elements - **Study Guides**: Structured study materials for various subjects ### ๐ŸŽฏ Grade-Appropriate Content - **K-2**: Early elementary content with visual aids and simple concepts - **3-5**: Upper elementary with hands-on activities - **6-8**: Middle school with analytical thinking - **9-12**: High school with advanced concepts and critical thinking ### ๐Ÿ“– Subject Coverage - **Science**: Biology, Chemistry, Physics, Earth Science - **Mathematics**: Algebra, Geometry, Statistics, Calculus - **History**: World History, US History, Ancient Civilizations - **English**: Literature, Writing, Grammar, Reading Comprehension - **Geography**: Physical and Human Geography - **Art**: Art History, Techniques, Creative Projects ### ๐ŸŽจ Advanced Features - **Image Generation**: AI-powered educational illustrations using Hugging Face models - **Math Rendering**: LaTeX to HTML conversion for mathematical expressions - **Progress Tracking**: Real-time generation progress with visual feedback - **Feedback System**: Built-in feedback collection and database storage - **Responsive UI**: Modern, intuitive interface built with Gradio ## ๐Ÿš€ Quick Start ### Prerequisites - Python 3.8 or higher - pip package manager ### Installation 1. **Clone the repository** ```bash git clone https://github.com/yourusername/brightmind-ai-clone.git cd brightmind-ai-clone ``` 2. **Install dependencies** ```bash pip install -r requirements.txt ``` 3. **Set up environment variables (optional)** ```bash export HUGGINGFACE_TOKEN="your_hf_token_here" export SMTP_USERNAME="your_email@example.com" export SMTP_PASSWORD="your_app_password" ``` 4. **Run the application** ```bash python app.py ``` 5. **Open your browser** Navigate to `http://localhost:7860` to access the application ## ๐Ÿ”ง Configuration ### Environment Variables | Variable | Description | Required | Default | |----------|-------------|----------|---------| | `HUGGINGFACE_TOKEN` | Hugging Face API token for AI content generation | No | None | | `SMTP_USERNAME` | Email username for feedback notifications | No | "" | | `SMTP_PASSWORD` | Email password for feedback notifications | No | "" | ### API Configuration The application automatically detects your Hugging Face token and uses it for enhanced content generation. Without a token, the app falls back to educational algorithms. **Getting a Hugging Face Token:** 1. Visit [Hugging Face](https://huggingface.co) 2. Create an account or sign in 3. Go to Settings โ†’ Access Tokens 4. Create a new token with "Read" permissions 5. Set the token as an environment variable ## ๐Ÿ“– Usage Guide ### Creating Lesson Plans 1. **Enter Topic**: Describe what you want to teach (e.g., "Photosynthesis", "World War II", "Quadratic Equations") 2. **Select Subject**: Choose from the dropdown menu 3. **Choose Grade Level**: Select appropriate grade range 4. **Set Duration**: Specify lesson length (30-180 minutes) 5. **Select Difficulty**: Choose Beginner, Intermediate, or Advanced 6. **Generate**: Click the generate button and watch the AI create your lesson plan ### Creating Quizzes 1. **Enter Topic**: Specify the quiz subject 2. **Select Subject**: Choose the academic subject 3. **Choose Grade Level**: Select appropriate grade range 4. **Set Question Count**: Specify number of questions (1-20) 5. **Select Question Types**: Choose from available question formats 6. **Generate**: Create your custom quiz ### Content Types Available - **Lesson Plans**: Complete structured lessons with objectives, activities, materials, and assessments - **Quizzes**: Interactive assessments with multiple question types - **Worksheets**: Practice materials and exercises - **Study Guides**: Comprehensive review materials ## ๐Ÿ—๏ธ Project Structure ``` brightmind-ai-clone/ โ”œโ”€โ”€ app.py # Main application file โ”œโ”€โ”€ config.py # Configuration and environment variables โ”œโ”€โ”€ ai_services.py # AI/ML functionality and API calls โ”œโ”€โ”€ content_generators.py # Content generation logic โ”œโ”€โ”€ database.py # Database operations and feedback storage โ”œโ”€โ”€ email_service.py # Email notification system โ”œโ”€โ”€ ui_components.py # UI components and styling โ”œโ”€โ”€ utils.py # Utility functions and helpers โ”œโ”€โ”€ algebra_solver.py # Mathematical problem solving โ”œโ”€โ”€ requirements.txt # Python dependencies โ”œโ”€โ”€ requirements_simple.txt # Minimal dependencies โ”œโ”€โ”€ requirements_complex.txt # Full feature dependencies โ”œโ”€โ”€ generated_images/ # AI-generated educational images โ”œโ”€โ”€ icons/ # Application icons and assets โ”œโ”€โ”€ test_*.py # Test files for various components โ””โ”€โ”€ README.md # This documentation ``` ## ๐Ÿ”Œ API Integration ### Hugging Face Models The application uses several Hugging Face models: - **Content Generation**: `deepseek-ai/DeepSeek-V3-0324` - **Image Generation**: - `stabilityai/stable-diffusion-xl-base-1.0` - `stabilityai/stable-diffusion-3-medium-diffusers` ### API Endpoints - **Content Generation**: `https://router.huggingface.co/v1/chat/completions` - **Image Generation**: `https://api-inference.huggingface.co/models/{model_name}` ## ๐Ÿงช Testing The project includes comprehensive test files: - `test_html_rendering.py`: Tests HTML rendering and LaTeX conversion - `test_image_api.py`: Tests image generation functionality - `test_specific_content.py`: Tests content generation with specific parameters **Running Tests:** ```bash python test_html_rendering.py python test_image_api.py python test_specific_content.py ``` ## ๐Ÿ“Š Database Schema The application uses SQLite for feedback storage: ```sql CREATE TABLE feedback ( id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp TEXT NOT NULL, feedback_type TEXT NOT NULL, rating INTEGER NOT NULL, comments TEXT NOT NULL, user_email TEXT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP ); ``` ## ๐ŸŽจ Customization ### UI Themes The application uses Gradio's Soft theme by default. You can customize the theme by modifying the `gr.themes.Soft()` parameter in `app.py`. ### Content Styling Educational content is styled with custom CSS for better readability and visual appeal. Styles are defined in the `ui_components.py` file. ### Image Generation Customize image generation by modifying prompts in `ai_services.py` or adding new image sources in the fallback system. ## ๐Ÿš€ Deployment ### Local Development ```bash python app.py ``` ### Production Deployment 1. Set up environment variables 2. Install production dependencies 3. Configure reverse proxy (nginx/Apache) 4. Set up SSL certificates 5. Deploy using your preferred method (Docker, PM2, etc.) ### Docker Deployment ```dockerfile FROM python:3.9-slim WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt COPY . . EXPOSE 7860 CMD ["python", "app.py"] ``` ## ๐Ÿค Contributing We welcome contributions! Please follow these steps: 1. Fork the repository 2. Create a feature branch (`git checkout -b feature/amazing-feature`) 3. Commit your changes (`git commit -m 'Add amazing feature'`) 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Open a Pull Request ### Development Setup ```bash git clone https://github.com/yourusername/brightmind-ai-clone.git cd brightmind-ai-clone pip install -r requirements.txt python app.py ``` ## ๐Ÿ“ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## ๐Ÿ™ Acknowledgments - [Gradio](https://gradio.app) for the amazing UI framework - [Hugging Face](https://huggingface.co) for providing access to state-of-the-art AI models - [Stability AI](https://stability.ai) for image generation capabilities - The educational community for inspiration and feedback ## ๐Ÿ“ž Support - **Issues**: [GitHub Issues](https://github.com/yourusername/brightmind-ai-clone/issues) - **Discussions**: [GitHub Discussions](https://github.com/yourusername/brightmind-ai-clone/discussions) - **Email**: mahdi@brightmind-ai.com ## ๐Ÿ”„ Changelog ### Version 1.0.0 - Initial release with AI-powered content generation - Support for lesson plans and quizzes - Hugging Face API integration - Image generation capabilities - Feedback system with database storage - Responsive UI with Gradio --- *BrightMind AI - Empowering educators with intelligent tools* ๐Ÿง โœจ **Last Updated**: September 2024