File size: 4,845 Bytes
2c843c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17131ca
 
2c843c7
 
 
 
 
 
 
 
17131ca
2c843c7
 
 
 
17131ca
2c843c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17131ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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("""
    <style>
        .stApp {
            background-color: #1f2937;
        }
        .stMarkdown {
            color: #f3f4f6;
        }
        .stButton > button {
            background-color: #6366F1;
            color: white;
        }
        .stButton > button:hover {
            background-color: #4F46E5;
        }
        .dark-theme {
            background-color: #111827;
            border-radius: 10px;
            padding: 20px;
            margin: 10px 0;
            border: 1px solid #374151;
        }
    </style>
    """, unsafe_allow_html=True)

def render_header():
    st.markdown("""
    <div class="dark-theme" style="text-align: center;">
        <h1>🎨 AI Style Transfer Studio</h1>
        <h3>Transform your ideas into artistic masterpieces</h3>
    </div>
    """, 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("""
        <div class="dark-theme">
            <h2>🎨 Style Guide</h2>
            <table>
                <tr>
                    <th>Style</th>
                    <th>Best For</th>
                </tr>
                <tr>
                    <td><strong>Dhoni Style</strong></td>
                    <td>Cricket scenes, sports action, victory celebrations</td>
                </tr>
                <tr>
                    <td><strong>Mickey Mouse Style</strong></td>
                    <td>Cartoon characters, playful scenes, whimsical art</td>
                </tr>
                <tr>
                    <td><strong>Balloon Style</strong></td>
                    <td>Festive scenes, colorful celebrations, light and airy compositions</td>
                </tr>
                <tr>
                    <td><strong>Lion King Style</strong></td>
                    <td>Animal portraits, majestic scenes, dramatic landscapes</td>
                </tr>
                <tr>
                    <td><strong>Rose Flower Style</strong></td>
                    <td>Floral art, romantic scenes, delicate compositions</td>
                </tr>
            </table>
            <em>Choose the style that best matches your creative vision</em>
        </div>
        """, unsafe_allow_html=True)

    with col2:
        st.markdown("""
        <div class="dark-theme">
            <h2>πŸ” Color Enhancement Technology</h2>
            <p>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:</p>
            <ul>
                <li>Enhance color separation</li>
                <li>Improve visual contrast</li>
                <li>Create more dynamic compositions</li>
                <li>Preserve artistic style while boosting vibrancy</li>
            </ul>
        </div>
        """, unsafe_allow_html=True)
def render_example_gallery():
    st.markdown("""
    <div class="dark-theme">
        <h2>πŸ–ΌοΈ Example Gallery</h2>
        <p>Here are some examples of AI-generated artwork:</p>
    </div>
    """, 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)