import streamlit as st from pathlib import Path def setup_page_config(): st.set_page_config( page_title="AI Style Transfer Studio", page_icon="🎨", layout="wide" ) def apply_custom_css(): st.markdown(""" """, unsafe_allow_html=True) def render_header(): st.markdown("""

🎨 AI Style Transfer Studio

Transform your ideas into artistic masterpieces

""", unsafe_allow_html=True) def render_controls(style_names): with st.sidebar: st.markdown("## 🎯 Controls") prompt = st.text_area( "What would you like to create?", placeholder="e.g., a soccer player celebrating a goal", height=100 ) selected_style = st.radio( "Choose Your Style", style_names, index=0 ) st.warning("⚠️ Please note: Image generation may take several hours in the free environment due to limited computational resources.") return prompt, selected_style def render_image_columns(base_image=None, enhanced_image=None): col1, col2 = st.columns(2) with col1: st.markdown("### Original Style") if base_image: st.image(base_image, use_container_width=True) with col2: st.markdown("### Color Enhanced") if enhanced_image: st.image(enhanced_image, use_container_width=True) def render_info_sections(): col1, col2 = st.columns(2) with col1: st.markdown("""

🎨 Style Guide

Style Best For
Dhoni Style Cricket scenes, sports action, victory celebrations
Mickey Mouse Style Cartoon characters, playful scenes, whimsical art
Balloon Style Festive scenes, colorful celebrations, light and airy compositions
Lion King Style Animal portraits, majestic scenes, dramatic landscapes
Rose Flower Style Floral art, romantic scenes, delicate compositions
Choose the style that best matches your creative vision
""", unsafe_allow_html=True) with col2: st.markdown("""

🔍 Color Enhancement Technology

Our advanced color processing uses distance loss to maximize the distinction between color channels, resulting in more vibrant and visually striking images. This technique helps to:

""", unsafe_allow_html=True) def render_example_gallery(): st.markdown("""

🖼️ Example Gallery

Here are some examples of AI-generated artwork:

""", unsafe_allow_html=True) # Get all jpg files from the generated_images directory image_dir = Path(__file__).parent.parent / "generated_images" image_files = list(image_dir.glob("*.jpg")) # Create columns for the gallery cols = st.columns(3) # Display images in the columns for idx, image_file in enumerate(image_files): with cols[idx % 3]: st.image(str(image_file), caption=image_file.stem.replace("_", " ").title(), use_container_width=True)