Team Ai
Apppublic

StanKonkin/Explainer_Docker

sourceHugging Facemitupdated 11mo agoView on Hugging Face
0likes
App README

๐Ÿง  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. 1.Fork or import this repository to your Hugging Face Space
  2. 2.Go to Settings โ†’ Repository secrets
  3. 3.Add secret: OPENAI_API_KEY with your OpenAI API key
  4. 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. 1.Click a quick example or enter your own question (up to 500 characters)
  2. 2.Adjust complexity level (1-5) using the slider to match your knowledge
  3. 3.Select your language from the dropdown (6 languages available)
  4. 4.Click "๐Ÿš€ Explain Concept" or press Ctrl/Cmd + Enter (keyboard shortcut)
  5. 5.Watch the explanation stream in real-time with live reading time estimate
  6. 6.Copy to clipboard with one click for easy sharing
  7. 7.Give feedback with ๐Ÿ‘ Helpful or ๐Ÿ‘Ž Not Helpful to improve the app

๐Ÿ“Š Complexity Levels Explained

LevelDescriptionBest For
1 ๐Ÿง’Like I'm 5 - Simple words and analogiesYoung learners, complete beginners
2 ๐Ÿ‘ฆLike I'm 10 - Basic concepts with examplesElementary understanding
3 ๐ŸŽ“High school - Intermediate with technical termsGeneral audience (default)
4 ๐ŸŽฏCollege - Advanced concepts with detailsStudents and professionals
5 ๐Ÿ‘จโ€๐Ÿ”ฌExpert - Professional depth and precisionSubject 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! ๐ŸŽฏ