Spaces:
Sleeping
Sleeping
File size: 6,897 Bytes
2f71d75 0a39810 255a910 6d8f225 2f71d75 a976d42 2f71d75 7997e54 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 7997e54 f86d663 7997e54 f86d663 7997e54 f86d663 a976d42 f86d663 7997e54 f86d663 a976d42 f86d663 a976d42 f86d663 a976d42 f86d663 7997e54 f86d663 7997e54 |
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 |
---
title: AI Concept Explainer
emoji: ๐ง
colorFrom: indigo
colorTo: gray
sdk: docker
pinned: false
license: mit
short_description: AI-powered concept explainer with adaptive complexity
---
# ๐ง AI Concept Explainer v2.0
A clean, Gradio app that explains any concept at different complexity levels using OpenAI's GPT-4.1-mini. Get personalized explanations tailored to your understanding level and preferred language, with a modern interface optimized for ease of use.
## โจ Features
### ๐ Core Functionality
- **5 Complexity Levels**: From "like I'm 5" to expert-level explanations
- **6 Languages**: English, Russian, German, Spanish, French, Italian
- **Real-time Streaming**: Watch explanations generate live with streaming responses
- **Quick Examples**: 3 pre-selected questions to get started instantly
### ๐จ Professional UI/UX
- **Compact Design**: Clean layout that fits on one screen without scrolling
- **Modern Gradient Header**: Beautiful purple gradient with professional styling
- **Dark/Light Mode**: Automatic theme detection with smooth transitions
- **Responsive Layout**: Optimized for desktop, tablet, and mobile (900px max-width)
- **Smooth Animations**: Entrance animations and hover effects throughout
### ๐ Productivity Features
- **๐ Copy to Clipboard**: One-click copy of any explanation
- **๐ Reading Time**: Real-time reading time estimates as text streams
- **โจ๏ธ Keyboard Shortcuts**: Ctrl/Cmd+Enter to submit, Escape to clear
- **๐ Character Counter**: Color-coded visual feedback (green/orange/red, 0/500 chars)
- **๐๐ Feedback**: Simple helpful/not helpful reactions for continuous improvement
- **๐ Clear Button**: Quick reset to start fresh
### ๐ก๏ธ Code Quality & Reliability
- **Type Hints**: Full type annotations throughout the codebase
- **Professional Logging**: Structured logging system (not print statements)
- **Error Handling**: User-friendly error messages with collapsible technical details
- **Input Validation**: Character limits, language verification, and edge case handling
- **Clean Architecture**: Well-organized code with clear sections and documentation
## ๐ Setup
### Hugging Face Spaces
1. Fork or import this repository to your Hugging Face Space
2. Go to **Settings** โ **Repository secrets**
3. Add secret: `OPENAI_API_KEY` with your OpenAI API key
4. The app will automatically deploy!
### Local Development
```bash
# Clone and navigate to the project
cd Explainer_docker
# Create virtual environment (Python 3.11+)
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Set your API key
echo "OPENAI_API_KEY=your_api_key_here" > .env
# Run the app
python app.py
```
Visit `http://127.0.0.1:7860` in your browser.
**To stop**: Press `Ctrl+C` in the terminal, then deactivate the virtual environment:
```bash
deactivate
```
### Docker Deployment
```bash
# Create .env file with your API key
echo "OPENAI_API_KEY=your_key_here" > .env
# Build and run
docker-compose up --build
# Access at http://localhost:7860
```
**To stop**: Press `Ctrl+C`, then:
```bash
docker-compose down
```
## ๐ฎ How to Use
1. **Click a quick example** or **enter your own question** (up to 500 characters)
2. **Adjust complexity level** (1-5) using the slider to match your knowledge
3. **Select your language** from the dropdown (6 languages available)
4. **Click "๐ Explain Concept"** or press `Ctrl/Cmd + Enter` (keyboard shortcut)
5. **Watch the explanation stream** in real-time with live reading time estimate
6. **Copy to clipboard** with one click for easy sharing
7. **Give feedback** with ๐ Helpful or ๐ Not Helpful to improve the app
### ๐ Complexity Levels Explained
| Level | Description | Best For |
|-------|-------------|----------|
| **1** ๐ง | Like I'm 5 - Simple words and analogies | Young learners, complete beginners |
| **2** ๐ฆ | Like I'm 10 - Basic concepts with examples | Elementary understanding |
| **3** ๐ | High school - Intermediate with technical terms | General audience (default) |
| **4** ๐ฏ | College - Advanced concepts with details | Students and professionals |
| **5** ๐จโ๐ฌ | Expert - Professional depth and precision | Subject matter experts |
## ๐ง Technical Stack
- **Framework**: Gradio 5.47.2 with custom theming
- **AI Model**: OpenAI GPT-4o-mini (optimized for quality and speed)
- **Language**: Python 3.11+ with type hints
- **UI/UX**: Custom CSS with Inter font, responsive design
- **Features**: Real-time streaming, session management, client-side interactivity
- **Architecture**: Modular code structure with proper separation of concerns
## ๐ Security
- API keys stored as environment variables only
- No data persistence or storage
- Secure HTTPS API calls to OpenAI
- `.env` files are gitignored and never committed
## ๐ License
MIT License - Part of the LLM and Agentic AI Bootcamp Materials.
## ๐ What's New in v2.0
### โจ New Features
- โ
**Compact, professional header** with beautiful gradient design
- โ
**Copy to clipboard** - Share explanations with one click
- โ
**Real-time reading time** - Know how long each explanation will take
- โ
**Character counter** - Visual feedback with color coding (green/orange/red)
- โ
**3 Quick examples** - Get started instantly with pre-selected questions
- โ
**Keyboard shortcuts** - Power user features (Ctrl/Cmd+Enter, Escape)
- โ
**User feedback system** - ๐/๐ to help improve the experience
- โ
**Clear button** - Quick reset to start fresh
- โ
**Enhanced error handling** - Friendly messages with technical details for debugging
### ๐ป Code Quality Improvements
- โ
**Full type hints** - Complete type annotations throughout the codebase
- โ
**Professional logging** - Structured logging system replacing print statements
- โ
**Modular organization** - Clean code structure with clear sections
- โ
**Comprehensive documentation** - Detailed docstrings for all functions
- โ
**Better error handling** - Categorized errors with helpful user messages
- โ
**Input validation** - Character limits, language verification, edge cases
### ๐จ UI/UX Enhancements
- โ
**One-screen design** - Everything fits without scrolling for optimal UX
- โ
**Wider but shorter** - 900px width, minimal vertical space
- โ
**Modern gradient header** - Professional purple gradient (indigo to purple)
- โ
**Inter font** - Modern, readable typography from Google Fonts
- โ
**Smooth animations** - Entrance effects and hover transitions
- โ
**Enhanced dark mode** - Automatic detection with beautiful themes
- โ
**Clean, focused layout** - No sidebars, distractions, or clutter
- โ
**Responsive design** - Works beautifully on desktop, tablet, and mobile
---
**v2.0** โข Built with โค๏ธ for learning โข Get clear explanations for any concept! ๐ฏ
|