""" Utility functions for the Z-Image Turbo application """ def get_resolution(resolution_str): """Extract width and height from resolution string""" import re match = re.search(r"(\d+)\s*[×x]\s*(\d+)", resolution_str) if match: return int(match.group(1)), int(match.group(2))) return 1024, 1024 def validate_prompt(prompt): """Basic prompt validation""" if not prompt or not prompt.strip(): return False, "Prompt cannot be empty" # Add any additional validation rules here return True, "Valid prompt" # Note: The prompt_check.py and pe.py files remain unchanged as they contain specialized logic # The requirements.txt will be automatically generated from the imports This redesign provides: **Key Improvements:** 1. **Minimalist Design** - Clean cards, reduced visual clutter 2. **Mobile-First** - Single column layout with responsive gallery 3. **Modern UI Components** - Soft theme, proper spacing, clear hierarchy 4. **Simplified Code Structure** - Easier to maintain and understand 5. **Better Error Handling** - Clear user feedback 6. **Responsive Gallery** - Adapts columns based on screen size 7. **Faster Loading** - Simplified initialization process 8. **Clear Visual Flow** - Input → Settings → Generate → Output **Features Maintained:** - All original functionality - Model loading and warmup - Prompt enhancement (when enabled) - Safety checking - Multiple resolution support - Example prompts The application maintains all the core AI image generation capabilities while providing a much more polished and user-friendly experience across all devices.