Spaces:
Sleeping
Sleeping
Commit History
-
🚫 Disable Content Generator Tab
Mahdi Naser Moghadasi✅ CHANGES MADE: • Commented out the entire Content Generator tab (lines 4513-4599) • Preserved all functionality for future re-enabling • All other tabs remain fully functional: - 🧮 MathMind Chatbot (with LaTeX, PDF support) - 🎯 Quiz Generator - 📚 Lesson Plan Generator 🔧 IMPLEMENTATION: • Used multi-line comment block to disable the tab • Added clear documentation for future reference • No code deletion - easy to re-enable when needed • All supporting functions remain intact 🎯 RESULT: • App now shows only: MathMind, Quiz Generator, Lesson Plans • Reduced complexity and focus on core features • Content Generator can be easily restored by uncommenting8e56f3c
-
🔧 Fix Gradio compatibility: Remove unsupported color_mode parameter, rely on CSS overrides for light mode
Mahdi Naser Moghadasi9c91697 -
🌞 Force light mode always: Disable dark mode even when users have Mac dark mode enabled
Mahdi Naser Moghadasibec2c19 -
🧠 Add intelligent document relevance checking: LLM decides if uploaded docs can answer question, mentions exact filename when using doc content
Mahdi Naser Moghadasi0b4267f -
🔓 Remove math-only restriction: Allow MathMind to answer any educational question, not just math
Mahdi Naser Moghadasi12fde5c -
📁 Simplify file management: Add multi-file upload support, remove dropdown selector, clean HTML display
Mahdi Naser Moghadasid2eb486 -
📁 Add comprehensive file management: Multiple PDF support, individual file removal, and document attribution in responses
Mahdi Naser Moghadasi35f8f30 -
🧠 Upgrade PDF validation: Use LLM intelligence instead of keywords for accurate math content detection
Mahdi Naser Moghadasi7837ea9
-
🛡️ Add safeguards: Question validation for math-only topics and enhanced PDF validation with summaries
Mahdi Naser Moghadasi8b6a701 -
✂️ Simplify MathMind welcome message: Remove verbose feature descriptions for cleaner UI
Mahdi Naser Moghadasicbedbaf -
🐛 Fix PDF upload error: Handle both file objects and bytes data properly
Mahdi Naser Moghadasi027aecf -
🔧 Fix LaTeX corruption: Simplify formatting function and improve API instructions for clean math expressions
Mahdi Naser Moghadasi2c7d8d0 -
🎉 Make MathMind super interactive: Add engaging prompts, fun facts, real-world examples, and grade-appropriate humor
Mahdi Naser Moghadasi792ede3 -
✨ Enable LaTeX rendering: Add latex_delimiters to chatbot and restore proper LaTeX formatting
Mahdi Naser Moghadasieeaf9a0 -
🔥 Remove all problematic LaTeX regex patterns - use only safe string replacements
Mahdi Naser Moghadasic86951d -
🚑 Emergency fix: Simplify LaTeX cleanup to avoid regex escape errors
Mahdi Naser Moghadasi149e3ee -
🐛 Fix regex error: Use raw strings for LaTeX replacement patterns to avoid escape sequence issues
Mahdi Naser Moghadasi5d79b13 -
🔧 Fix LaTeX rendering: Clean up malformed LaTeX patterns and improve formula display
Mahdi Naser Moghadasicf6a654 -
Enhance MathMind chatbot: Remove repetitive introductions, add age-appropriate responses, improve LaTeX rendering, and add typing effect
Mahdi Naser Moghadasiea14373 -
Fix TypeError: Fix pdf_context parameter handling in MathMind API call
Mahdi Naser Moghadasifb9b29b -
✨ Add MathMind Interactive Math Tutor Tab
Mahdi Naser Moghadasi🧮 New MathMind Features: - Interactive math chatbot with conversation memory - Age-appropriate explanations (K-2 through College) - PDF context management with math-content validation - LaTeX formula rendering support - Text-to-image generation for mathematical diagrams - Content guardrails for safe, educational responses - Step-by-step problem solving - Interactive questioning to check understanding 🔧 Technical Implementation: - PDF processing with PyPDF2 for context awareness - Math keyword validation for uploaded PDFs - Conversation history management - Integration with Hugging Face API - Custom LaTeX formatting patterns - Mathematical image generation - Content safety filters 📚 Educational Features: - Grade-level appropriate responses - Interactive teaching methodology - Visual learning with diagrams - Context-aware tutoring from PDFs - Encouragement and positive reinforcement - Fun and engaging math learningaa34ccb
-
Fix image content preservation and reduce aggressive HTML cleaning
Mahdi Naser Moghadasi- Modified fix_malformed_image_html to only remove truly malformed images - Reduced aggressive regex patterns in apply_content_styling that were removing valid image content - Preserve images with data: and http: src attributes - This should fix the content loss from 3929 to 1388 charactersc32c891 -
Fix content truncation and add dynamic token limits
Mahdi Naser Moghadasi- Add dynamic max_tokens based on content length (Short: 2000, Medium: 4000, Long: 6000) - Fix apply_content_styling function that was aggressively removing content - Add image generation debugging to track image display issues - Pass content_length parameter to API call for proper token allocation7a3654e -
Increase max_tokens to 4000 and add debugging for content truncation
Mahdi Naser Moghadasi- Increased max_tokens from 1000 to 4000 for comprehensive content generation - Added detailed debugging logs to track content length through processing pipeline - This should resolve the issue where content was being truncated from 3757 to 583 charactersf333cd1 -
Update image generation functions with improved error handling and performance
Mahdi Naser Moghadasi- Enhanced generate_image_with_huggingface with better size management - Improved generate_real_image with size checking and fallback mechanisms - Added generate_image_fallback function for styled text placeholders - Streamlined process_content_with_images with image limits - Simplified fix_malformed_image_html with better error handling9cec69e -
Fix image display by using actual base64 data instead of placeholders
Mahdi Naser Moghadasi- Restore actual img tags with base64 image data - Optimize image generation with smaller, faster models - Reduce base64 size limit to 75KB for better Gradio compatibility - Use 512x512 images with 10 inference steps for speed - Add proper image descriptions below each image - Fix the root cause: images were being converted to placeholders instead of displayedb007c47 -
Replace base64 images with beautiful placeholders
Mahdi Naser Moghadasi- Remove base64 image display that doesn't work in Gradio HTML - Create attractive gradient placeholders for generated images - Show image descriptions and generation status - Ensure consistent visual experience across all content - Focus on reliable display over complex image embeddingdee9062 -
Optimize image display for Gradio compatibility
Mahdi Naser Moghadasi- Reduce image dimensions to 256x256 for smaller base64 strings - Lower base64 size limit to 200KB for better Gradio performance - Simplify image generation to use base64 instead of file paths - Remove complex file saving logic that may cause issues - Focus on smaller, more reliable base64 images92e2845 -
Fix image HTML processing to preserve file path images
Mahdi Naser Moghadasi- Update fix_malformed_image_html function to handle file path images - Add detection for .png file paths in img src attributes - Prevent file path images from being converted to placeholders - Images should now display properly instead of showing fallback text7a273a8 -
Implement file-based image storage for better Gradio compatibility
Mahdi Naser Moghadasi- Save generated images to files instead of using base64 in HTML - Use file paths in img src instead of data URLs - Create generated_images directory for image storage - Add fallback to base64 if file saving fails - Should resolve image display issues in Gradio interfaceab01353 -
Fix image dimensions for Hugging Face API compatibility
Mahdi Naser Moghadasi- Change image dimensions from 300x300 to 288x288 (divisible by 16) - Add more model options for better fallback support - Fix API error: height and width must be divisible by 8/16 - Images should now generate successfully instead of falling back47262e1 -
Optimize image display for better Gradio compatibility
Mahdi Naser Moghadasi- Reduce image dimensions to 300x300 for smaller base64 strings - Lower base64 size limit to 500KB for better display - Improve fallback UI with gradient backgrounds and better styling - Add more robust error handling for image display issues - Optimize for Gradio HTML rendering limitations573f36e -
Add debugging for image generation and display
Mahdi Naser Moghadasi- Add detailed logging for image data length and preview - Add fallback logging when no image data is generated - Improve debugging output for HTML generation - Help diagnose base64 image display issues45b4b13 -
Fix base64 image handling and add error fallbacks
Mahdi Naser Moghadasi- Add size limit for base64 images (1MB max) - Reduce image dimensions to 400x400 to prevent large base64 strings - Add error handling for base64 encoding failures - Add fallback display when images fail to load - Improve image generation robustness1ed7f03 -
Fix Hugging Face Space configuration - add required YAML frontmatter to README.md
Mahdi Naser Moghadasibdeb988 -
Add test_image_api.py to gitignore to prevent token exposure
Mahdi Naser Moghadasif3cd193 -
Merge fix-image-generation branch with image display fixes
Mahdi Naser Moghadasi477b0df -
Fix image display issue and add comprehensive README
Mahdi Naser Moghadasi- Fixed malformed HTML image tags (srcdata: -> src="data:") - Enhanced fix_malformed_image_html() function with better regex patterns - Added comprehensive README.md with full documentation - Images now display properly in educational content1d24f1f -
Fix malformed image HTML generation
Mahdi Naser Moghadasi- Fixed issue where image HTML was generated as <div styledata:> instead of <img src=> - Added regex pattern to detect and fix styledata malformation - Updated fix_malformed_image_html function to handle the specific case - Tested fix with actual malformed content from test.html - Images now display properly with correct HTML structuree9e471e -
Fix malformed image HTML generation
Mahdi Naser Moghadasi- Enhanced generate_real_image function with proper base64 validation - Added fix_malformed_image_html function to repair corrupted img tags - Improved error handling and logging for image generation - Added HTML escaping for image descriptions - Integrated HTML fixing into content processing pipeline - Fixed missing src= attribute and corrupted text in image tagsc64d3ea -
Fix image display issue - stop removing valid image tags
Mahdi Naser Moghadasi- Commented out the regex that was removing all img tags with style attributes - This was causing generated images to be stripped from the content - Images should now display properly in the UI - The issue was in apply_content_styling function line 2014b72a100 -
Add detailed debug logging for image processing
Mahdi Naser Moghadasi- Added logging to show generated HTML for each image - Added logging to show final content after image processing - This will help identify why images are generated but not displayed - Debug output will show if HTML is being generated correctly2741810 -
Add comprehensive image pattern matching and debug logging
Mahdi Naser Moghadasi- Added support for all image pattern formats including 📸 Image patterns - Added debug logging to see what patterns are actually in the content - Enhanced pattern replacement logic to handle all formats - This should fix the issue where images are generated but not displayedd63fbd5 -
Fix image generation in main app.py with working models
Mahdi Naser Moghadasi- Updated generate_image_with_huggingface function in app.py to use working models - Changed from runwayml/stable-diffusion-v1-5 (404 error) to stabilityai models - Added proper API parameters and error handling - This fixes the 404 errors seen in the logsd965642 -
Fix Hugging Face image generation with working models
Mahdi Naser Moghadasi- Updated to use tested working models: stabilityai/stable-diffusion-xl-base-1.0 and stabilityai/stable-diffusion-3-medium-diffusers - Added proper API parameters (num_inference_steps, guidance_scale) - Added fallback logic to try multiple models - Tested and verified image generation works correctly - Images are now properly generated and returned as base64 data10655ae -
Fix image pattern matching and add debug logging
Mahdi Naser Moghadasi- Added support for markdown bold format: **[📸 Image: ...]** - Added comprehensive regex patterns for all image formats - Added debug logging to track pattern matching - Enhanced pattern matching for better content processing - Added content preview logging for debugginga41632c -
Fix Hugging Face image generation API issues
Mahdi Naser Moghadasi- Simplified image generation to use single reliable model - Added proper 404 error handling for model not found - Improved fallback placeholder generation with description-based URLs - Enhanced error logging for better debugging - Fixed API endpoint usage for text-to-image models6f840ea -
Fix image and interactive element pattern matching
Mahdi Naser Moghadasi- Fixed regex patterns to properly match [📸 Image: ...] format - Added support for patterns with 'Visual content would appear here' suffix - Added support for [INTERACTIVE: ...] elements with styled placeholders - Improved pattern matching for better content processing469f820 -
Fix image generation and display issues
Mahdi Naser Moghadasi- Updated image pattern matching to include 📸 Image: patterns - Fixed image URL handling to properly display placeholder images - Improved fallback logic for when AI image generation fails - Enhanced image placeholder styling for better user experience4a31143 -
Refactor app.py into modular architecture
Mahdi Naser Moghadasi- Created config.py for configuration and constants - Created database.py for database operations - Created email_service.py for email functionality - Created ai_services.py for AI/ML related functions - Created content_generators.py for lesson plan and quiz generation - Created ui_components.py for Gradio interface components - Created utils.py for utility functions - Created app_modular.py as new main entry point - Updated generate_image_with_huggingface with improved error handling and multiple model fallbacks - Improved code organization and maintainability6cff14b