import gradio as gr from typing import Dict, List from style import Style class UIManager: """Manages all UI components and styling for Pixcribe""" def __init__(self): # Use centralized Style class for all CSS self.custom_css = Style.get_all_css() def create_header(self): """Create application header""" return gr.HTML("""
AI-Powered Social Media Caption Generator
Initial setup and model loading may take a while as multiple AI models are initialized and cached. This includes YOLOv11 object detection, OpenCLIP semantic analysis, Qwen2.5-VL caption generation, and other advanced models.
✨ Processing time varies depending on system resources. Thank you for your patience while we generate high-quality captions!
No captions generated
" captions_html = "" for i, cap in enumerate(captions): caption_text = cap.get('caption', '') hashtags = cap.get('hashtags', []) tone = cap.get('tone', 'unknown').title() # Create unique ID for each caption caption_id = f"caption_{i}" # Full text to copy (caption + hashtags) full_text = f"{caption_text}\n\n{' '.join([f'#{tag}' for tag in hashtags])}" captions_html += f"""No results to display
" # Build summary card total_processed = batch_results.get('total_processed', 0) total_success = batch_results.get('total_success', 0) total_failed = batch_results.get('total_failed', 0) total_time = batch_results.get('total_time', 0) avg_time = batch_results.get('average_time_per_image', 0) html_parts = [] # Summary card html_parts.append(f"""