Commit
·
17131ca
1
Parent(s):
44ed09d
Add example image
Browse files- src/app.py +6 -2
- src/generated_images/dhoni_soccer_player.jpg +0 -0
- src/utils/ui_components.py +24 -3
src/app.py
CHANGED
|
@@ -6,7 +6,8 @@ from utils.ui_components import (
|
|
| 6 |
render_header,
|
| 7 |
render_controls,
|
| 8 |
render_image_columns,
|
| 9 |
-
render_info_sections
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
# Initialize the application
|
|
@@ -44,4 +45,7 @@ render_image_columns(
|
|
| 44 |
)
|
| 45 |
|
| 46 |
# Render information sections
|
| 47 |
-
render_info_sections()
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
render_header,
|
| 7 |
render_controls,
|
| 8 |
render_image_columns,
|
| 9 |
+
render_info_sections,
|
| 10 |
+
render_example_gallery
|
| 11 |
)
|
| 12 |
|
| 13 |
# Initialize the application
|
|
|
|
| 45 |
)
|
| 46 |
|
| 47 |
# Render information sections
|
| 48 |
+
render_info_sections()
|
| 49 |
+
|
| 50 |
+
# Display example gallery
|
| 51 |
+
render_example_gallery()
|
src/generated_images/dhoni_soccer_player.jpg
ADDED
|
src/utils/ui_components.py
CHANGED
|
@@ -58,6 +58,8 @@ def render_controls(style_names):
|
|
| 58 |
index=0
|
| 59 |
)
|
| 60 |
|
|
|
|
|
|
|
| 61 |
return prompt, selected_style
|
| 62 |
|
| 63 |
def render_image_columns(base_image=None, enhanced_image=None):
|
|
@@ -66,12 +68,12 @@ def render_image_columns(base_image=None, enhanced_image=None):
|
|
| 66 |
with col1:
|
| 67 |
st.markdown("### Original Style")
|
| 68 |
if base_image:
|
| 69 |
-
st.image(base_image,
|
| 70 |
|
| 71 |
with col2:
|
| 72 |
st.markdown("### Color Enhanced")
|
| 73 |
if enhanced_image:
|
| 74 |
-
st.image(enhanced_image,
|
| 75 |
|
| 76 |
def render_info_sections():
|
| 77 |
col1, col2 = st.columns(2)
|
|
@@ -123,4 +125,23 @@ def render_info_sections():
|
|
| 123 |
<li>Preserve artistic style while boosting vibrancy</li>
|
| 124 |
</ul>
|
| 125 |
</div>
|
| 126 |
-
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
index=0
|
| 59 |
)
|
| 60 |
|
| 61 |
+
st.warning("⚠️ Please note: Image generation may take several hours in the free environment due to limited computational resources.")
|
| 62 |
+
|
| 63 |
return prompt, selected_style
|
| 64 |
|
| 65 |
def render_image_columns(base_image=None, enhanced_image=None):
|
|
|
|
| 68 |
with col1:
|
| 69 |
st.markdown("### Original Style")
|
| 70 |
if base_image:
|
| 71 |
+
st.image(base_image, use_container_width=True)
|
| 72 |
|
| 73 |
with col2:
|
| 74 |
st.markdown("### Color Enhanced")
|
| 75 |
if enhanced_image:
|
| 76 |
+
st.image(enhanced_image, use_container_width=True)
|
| 77 |
|
| 78 |
def render_info_sections():
|
| 79 |
col1, col2 = st.columns(2)
|
|
|
|
| 125 |
<li>Preserve artistic style while boosting vibrancy</li>
|
| 126 |
</ul>
|
| 127 |
</div>
|
| 128 |
+
""", unsafe_allow_html=True)
|
| 129 |
+
def render_example_gallery():
|
| 130 |
+
st.markdown("""
|
| 131 |
+
<div class="dark-theme">
|
| 132 |
+
<h2>🖼️ Example Gallery</h2>
|
| 133 |
+
<p>Here are some examples of AI-generated artwork:</p>
|
| 134 |
+
</div>
|
| 135 |
+
""", unsafe_allow_html=True)
|
| 136 |
+
|
| 137 |
+
# Get all jpg files from the generated_images directory
|
| 138 |
+
image_dir = Path(__file__).parent.parent / "generated_images"
|
| 139 |
+
image_files = list(image_dir.glob("*.jpg"))
|
| 140 |
+
|
| 141 |
+
# Create columns for the gallery
|
| 142 |
+
cols = st.columns(3)
|
| 143 |
+
|
| 144 |
+
# Display images in the columns
|
| 145 |
+
for idx, image_file in enumerate(image_files):
|
| 146 |
+
with cols[idx % 3]:
|
| 147 |
+
st.image(str(image_file), caption=image_file.stem.replace("_", " ").title(), use_container_width=True)
|