Spaces:
Sleeping
Sleeping
github-actions[bot] commited on
Commit ·
344905d
1
Parent(s): df5c421
Deploy from GitHub - 2026-01-19 07:10:25
Browse files
app.py
CHANGED
|
@@ -1483,9 +1483,16 @@ def stylize_image_impl(
|
|
| 1483 |
return None, error_msg, None
|
| 1484 |
|
| 1485 |
|
| 1486 |
-
#
|
| 1487 |
-
#
|
| 1488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1489 |
|
| 1490 |
|
| 1491 |
def process_webcam_frame(image: Image.Image, style: str, backend: str) -> Image.Image:
|
|
@@ -1726,92 +1733,475 @@ def create_style_blend_output(
|
|
| 1726 |
# ============================================================================
|
| 1727 |
|
| 1728 |
custom_css = """
|
| 1729 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1730 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1731 |
max-width: 1400px;
|
| 1732 |
margin: auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1733 |
}
|
| 1734 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1735 |
.gr-button-primary {
|
| 1736 |
-
background: linear-gradient(135deg,
|
| 1737 |
-
|
|
|
|
|
|
|
| 1738 |
color: white !important;
|
| 1739 |
font-weight: 600 !important;
|
| 1740 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1741 |
}
|
| 1742 |
|
| 1743 |
.gr-button-primary:hover {
|
| 1744 |
-
transform: translateY(-
|
| 1745 |
-
box-shadow: 0
|
| 1746 |
}
|
| 1747 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1748 |
.gr-button-secondary {
|
| 1749 |
-
background:
|
| 1750 |
-
|
| 1751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1752 |
}
|
| 1753 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1754 |
h1 {
|
| 1755 |
text-align: center;
|
| 1756 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 1757 |
-webkit-background-clip: text;
|
| 1758 |
-webkit-text-fill-color: transparent;
|
| 1759 |
background-clip: text;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1760 |
}
|
| 1761 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1762 |
.live-badge {
|
| 1763 |
display: inline-block;
|
| 1764 |
-
padding:
|
| 1765 |
-
background: linear-gradient(135deg,
|
|
|
|
| 1766 |
color: white;
|
| 1767 |
border-radius: 20px;
|
| 1768 |
font-size: 12px;
|
| 1769 |
font-weight: 600;
|
| 1770 |
-
|
|
|
|
|
|
|
| 1771 |
}
|
| 1772 |
|
| 1773 |
-
@keyframes pulse {
|
| 1774 |
-
0%, 100% {
|
| 1775 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1776 |
}
|
| 1777 |
|
|
|
|
| 1778 |
.backend-badge {
|
| 1779 |
display: inline-block;
|
| 1780 |
-
padding:
|
| 1781 |
-
background: linear-gradient(135deg,
|
|
|
|
| 1782 |
color: white;
|
| 1783 |
border-radius: 20px;
|
| 1784 |
font-size: 12px;
|
| 1785 |
font-weight: 600;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1786 |
}
|
| 1787 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1788 |
.footer {
|
| 1789 |
text-align: center;
|
| 1790 |
margin-top: 2rem;
|
| 1791 |
-
padding
|
| 1792 |
-
|
| 1793 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1794 |
}
|
| 1795 |
|
| 1796 |
/* Mobile optimization */
|
| 1797 |
@media (max-width: 768px) {
|
| 1798 |
.gradio-container {
|
| 1799 |
padding: 1rem 0.5rem !important;
|
|
|
|
| 1800 |
}
|
|
|
|
| 1801 |
.gr-row {
|
| 1802 |
flex-direction: column !important;
|
| 1803 |
}
|
|
|
|
| 1804 |
.gr-column {
|
| 1805 |
width: 100% !important;
|
| 1806 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1807 |
}
|
| 1808 |
"""
|
| 1809 |
|
| 1810 |
with gr.Blocks(
|
| 1811 |
title="StyleForge: Neural Style Transfer",
|
| 1812 |
-
theme=gr.themes.
|
| 1813 |
primary_hue="indigo",
|
| 1814 |
secondary_hue="purple",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1815 |
),
|
| 1816 |
css=custom_css
|
| 1817 |
) as demo:
|
|
@@ -1819,15 +2209,14 @@ with gr.Blocks(
|
|
| 1819 |
# Header with CUDA badge and dev notice
|
| 1820 |
cuda_badge = f"<span class='backend-badge'>CUDA Available</span>" if CUDA_KERNELS_AVAILABLE else ""
|
| 1821 |
gr.Markdown(f"""
|
| 1822 |
-
|
| 1823 |
-
|
| 1824 |
-
|
| 1825 |
-
|
| 1826 |
-
|
| 1827 |
-
|
| 1828 |
-
|
| 1829 |
-
|
| 1830 |
-
**Features:** Custom Styles • Region Transfer • Style Blending • Performance Charts
|
| 1831 |
""")
|
| 1832 |
|
| 1833 |
# Mode selector
|
|
|
|
| 1483 |
return None, error_msg, None
|
| 1484 |
|
| 1485 |
|
| 1486 |
+
# Wrap with GPU decorator for ZeroGPU if available
|
| 1487 |
+
# ZeroGPU requires at least one @GPU function to be present
|
| 1488 |
+
if SPACES_AVAILABLE:
|
| 1489 |
+
try:
|
| 1490 |
+
stylize_image = GPU(stylize_image_impl)
|
| 1491 |
+
except Exception:
|
| 1492 |
+
# Fallback if GPU decorator fails
|
| 1493 |
+
stylize_image = stylize_image_impl
|
| 1494 |
+
else:
|
| 1495 |
+
stylize_image = stylize_image_impl
|
| 1496 |
|
| 1497 |
|
| 1498 |
def process_webcam_frame(image: Image.Image, style: str, backend: str) -> Image.Image:
|
|
|
|
| 1733 |
# ============================================================================
|
| 1734 |
|
| 1735 |
custom_css = """
|
| 1736 |
+
/* ============================================
|
| 1737 |
+
LIQUID GLASS / GLASSMORPHISM THEME
|
| 1738 |
+
============================================ */
|
| 1739 |
+
|
| 1740 |
+
/* Root variables for glass theme */
|
| 1741 |
+
:root {
|
| 1742 |
+
--glass-bg: rgba(255, 255, 255, 0.12);
|
| 1743 |
+
--glass-border: rgba(255, 255, 255, 0.2);
|
| 1744 |
+
--glass-shadow: rgba(0, 0, 0, 0.1);
|
| 1745 |
+
--glass-blur: blur(20px);
|
| 1746 |
+
--accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
|
| 1747 |
+
--accent-glow: rgba(102, 126, 234, 0.4);
|
| 1748 |
+
}
|
| 1749 |
+
|
| 1750 |
+
/* Animated gradient background */
|
| 1751 |
+
body {
|
| 1752 |
+
background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #0f0c29);
|
| 1753 |
+
background-size: 400% 400%;
|
| 1754 |
+
animation: gradientShift 15s ease infinite;
|
| 1755 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
| 1756 |
+
min-height: 100vh;
|
| 1757 |
+
}
|
| 1758 |
+
|
| 1759 |
+
@keyframes gradientShift {
|
| 1760 |
+
0% { background-position: 0% 50%; }
|
| 1761 |
+
50% { background-position: 100% 50%; }
|
| 1762 |
+
100% { background-position: 0% 50%; }
|
| 1763 |
+
}
|
| 1764 |
+
|
| 1765 |
+
/* Main container with glass effect */
|
| 1766 |
+
.gradio-container {
|
| 1767 |
max-width: 1400px;
|
| 1768 |
margin: auto;
|
| 1769 |
+
background: rgba(15, 12, 41, 0.6) !important;
|
| 1770 |
+
backdrop-filter: blur(30px) saturate(180%);
|
| 1771 |
+
-webkit-backdrop-filter: blur(30px) saturate(180%);
|
| 1772 |
+
border-radius: 24px;
|
| 1773 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 1774 |
+
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
| 1775 |
+
overflow: hidden;
|
| 1776 |
}
|
| 1777 |
|
| 1778 |
+
/* Glass panels for components */
|
| 1779 |
+
.gr-box {
|
| 1780 |
+
background: var(--glass-bg) !important;
|
| 1781 |
+
backdrop-filter: var(--glass-blur);
|
| 1782 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 1783 |
+
border: 1px solid var(--glass-border) !important;
|
| 1784 |
+
border-radius: 16px !important;
|
| 1785 |
+
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1) !important;
|
| 1786 |
+
}
|
| 1787 |
+
|
| 1788 |
+
.gr-image-container {
|
| 1789 |
+
border-radius: 16px !important;
|
| 1790 |
+
overflow: hidden;
|
| 1791 |
+
border: 1px solid rgba(255, 255, 255, 0.15) !important;
|
| 1792 |
+
}
|
| 1793 |
+
|
| 1794 |
+
/* Primary button - liquid glass effect */
|
| 1795 |
.gr-button-primary {
|
| 1796 |
+
background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%) !important;
|
| 1797 |
+
backdrop-filter: blur(10px);
|
| 1798 |
+
-webkit-backdrop-filter: blur(10px);
|
| 1799 |
+
border: 1px solid rgba(255, 255, 255, 0.3) !important;
|
| 1800 |
color: white !important;
|
| 1801 |
font-weight: 600 !important;
|
| 1802 |
+
border-radius: 14px !important;
|
| 1803 |
+
padding: 12px 24px !important;
|
| 1804 |
+
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
|
| 1805 |
+
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
|
| 1806 |
+
position: relative;
|
| 1807 |
+
overflow: hidden;
|
| 1808 |
+
}
|
| 1809 |
+
|
| 1810 |
+
.gr-button-primary::before {
|
| 1811 |
+
content: '';
|
| 1812 |
+
position: absolute;
|
| 1813 |
+
top: 0;
|
| 1814 |
+
left: -100%;
|
| 1815 |
+
width: 100%;
|
| 1816 |
+
height: 100%;
|
| 1817 |
+
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
| 1818 |
+
transition: left 0.5s;
|
| 1819 |
+
}
|
| 1820 |
+
|
| 1821 |
+
.gr-button-primary:hover::before {
|
| 1822 |
+
left: 100%;
|
| 1823 |
}
|
| 1824 |
|
| 1825 |
.gr-button-primary:hover {
|
| 1826 |
+
transform: translateY(-3px) scale(1.02);
|
| 1827 |
+
box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
|
| 1828 |
}
|
| 1829 |
|
| 1830 |
+
.gr-button-primary:active {
|
| 1831 |
+
transform: translateY(-1px) scale(0.98);
|
| 1832 |
+
}
|
| 1833 |
+
|
| 1834 |
+
/* Secondary button */
|
| 1835 |
.gr-button-secondary {
|
| 1836 |
+
background: rgba(255, 255, 255, 0.1) !important;
|
| 1837 |
+
backdrop-filter: blur(10px);
|
| 1838 |
+
-webkit-backdrop-filter: blur(10px);
|
| 1839 |
+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 1840 |
+
color: rgba(255, 255, 255, 0.9) !important;
|
| 1841 |
+
border-radius: 14px !important;
|
| 1842 |
+
transition: all 0.3s ease !important;
|
| 1843 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
|
| 1844 |
}
|
| 1845 |
|
| 1846 |
+
.gr-button-secondary:hover {
|
| 1847 |
+
background: rgba(255, 255, 255, 0.2) !important;
|
| 1848 |
+
transform: translateY(-2px);
|
| 1849 |
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2) !important;
|
| 1850 |
+
}
|
| 1851 |
+
|
| 1852 |
+
/* Dropdown styling */
|
| 1853 |
+
.gr-dropdown {
|
| 1854 |
+
background: rgba(255, 255, 255, 0.08) !important;
|
| 1855 |
+
backdrop-filter: blur(10px);
|
| 1856 |
+
border: 1px solid rgba(255, 255, 255, 0.15) !important;
|
| 1857 |
+
border-radius: 12px !important;
|
| 1858 |
+
}
|
| 1859 |
+
|
| 1860 |
+
.gr-dropdown-options {
|
| 1861 |
+
background: rgba(30, 30, 60, 0.95) !important;
|
| 1862 |
+
backdrop-filter: blur(20px);
|
| 1863 |
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 1864 |
+
border-radius: 12px !important;
|
| 1865 |
+
}
|
| 1866 |
+
|
| 1867 |
+
/* Slider styling */
|
| 1868 |
+
input[type="range"] {
|
| 1869 |
+
-webkit-appearance: none;
|
| 1870 |
+
background: rgba(255, 255, 255, 0.1);
|
| 1871 |
+
border-radius: 10px;
|
| 1872 |
+
height: 8px;
|
| 1873 |
+
}
|
| 1874 |
+
|
| 1875 |
+
input[type="range"]::-webkit-slider-thumb {
|
| 1876 |
+
-webkit-appearance: none;
|
| 1877 |
+
width: 20px;
|
| 1878 |
+
height: 20px;
|
| 1879 |
+
background: linear-gradient(135deg, #667eea, #764ba2);
|
| 1880 |
+
border-radius: 50%;
|
| 1881 |
+
cursor: pointer;
|
| 1882 |
+
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
|
| 1883 |
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
| 1884 |
+
}
|
| 1885 |
+
|
| 1886 |
+
/* Radio buttons */
|
| 1887 |
+
.gr-radio {
|
| 1888 |
+
background: rgba(255, 255, 255, 0.05) !important;
|
| 1889 |
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 1890 |
+
border-radius: 12px !important;
|
| 1891 |
+
padding: 12px !important;
|
| 1892 |
+
}
|
| 1893 |
+
|
| 1894 |
+
.gr-radio:hover {
|
| 1895 |
+
background: rgba(255, 255, 255, 0.1) !important;
|
| 1896 |
+
}
|
| 1897 |
+
|
| 1898 |
+
/* Tab styling */
|
| 1899 |
+
.tabs {
|
| 1900 |
+
background: rgba(255, 255, 255, 0.05) !important;
|
| 1901 |
+
backdrop-filter: blur(10px);
|
| 1902 |
+
border-radius: 16px !important;
|
| 1903 |
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 1904 |
+
padding: 8px !important;
|
| 1905 |
+
}
|
| 1906 |
+
|
| 1907 |
+
.tab-item {
|
| 1908 |
+
background: transparent !important;
|
| 1909 |
+
border-radius: 12px !important;
|
| 1910 |
+
transition: all 0.3s ease !important;
|
| 1911 |
+
}
|
| 1912 |
+
|
| 1913 |
+
.tab-item:hover {
|
| 1914 |
+
background: rgba(255, 255, 255, 0.1) !important;
|
| 1915 |
+
}
|
| 1916 |
+
|
| 1917 |
+
.tab-item.selected {
|
| 1918 |
+
background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4)) !important;
|
| 1919 |
+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 1920 |
+
}
|
| 1921 |
+
|
| 1922 |
+
/* Accordion styling */
|
| 1923 |
+
details {
|
| 1924 |
+
background: rgba(255, 255, 255, 0.05) !important;
|
| 1925 |
+
backdrop-filter: blur(10px);
|
| 1926 |
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 1927 |
+
border-radius: 16px !important;
|
| 1928 |
+
overflow: hidden;
|
| 1929 |
+
}
|
| 1930 |
+
|
| 1931 |
+
summary {
|
| 1932 |
+
background: rgba(255, 255, 255, 0.08) !important;
|
| 1933 |
+
border-radius: 16px !important;
|
| 1934 |
+
padding: 16px !important;
|
| 1935 |
+
cursor: pointer;
|
| 1936 |
+
transition: all 0.3s ease;
|
| 1937 |
+
}
|
| 1938 |
+
|
| 1939 |
+
summary:hover {
|
| 1940 |
+
background: rgba(255, 255, 255, 0.15) !important;
|
| 1941 |
+
}
|
| 1942 |
+
|
| 1943 |
+
/* Headings with gradient text */
|
| 1944 |
h1 {
|
| 1945 |
text-align: center;
|
| 1946 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
|
| 1947 |
-webkit-background-clip: text;
|
| 1948 |
-webkit-text-fill-color: transparent;
|
| 1949 |
background-clip: text;
|
| 1950 |
+
font-weight: 800;
|
| 1951 |
+
font-size: 2.5rem;
|
| 1952 |
+
letter-spacing: -0.02em;
|
| 1953 |
+
text-shadow: 0 0 40px rgba(102, 126, 234, 0.3);
|
| 1954 |
+
}
|
| 1955 |
+
|
| 1956 |
+
h2, h3 {
|
| 1957 |
+
color: rgba(255, 255, 255, 0.95) !important;
|
| 1958 |
}
|
| 1959 |
|
| 1960 |
+
/* Markdown text color */
|
| 1961 |
+
.markdown {
|
| 1962 |
+
color: rgba(255, 255, 255, 0.85) !important;
|
| 1963 |
+
}
|
| 1964 |
+
|
| 1965 |
+
.markdown strong {
|
| 1966 |
+
color: rgba(255, 255, 255, 1) !important;
|
| 1967 |
+
}
|
| 1968 |
+
|
| 1969 |
+
/* Live badge with glow */
|
| 1970 |
.live-badge {
|
| 1971 |
display: inline-block;
|
| 1972 |
+
padding: 6px 16px;
|
| 1973 |
+
background: linear-gradient(135deg, rgba(239, 68, 68, 0.8), rgba(220, 38, 38, 0.8));
|
| 1974 |
+
backdrop-filter: blur(10px);
|
| 1975 |
color: white;
|
| 1976 |
border-radius: 20px;
|
| 1977 |
font-size: 12px;
|
| 1978 |
font-weight: 600;
|
| 1979 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 1980 |
+
animation: pulse-glow 2s infinite;
|
| 1981 |
+
box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
|
| 1982 |
}
|
| 1983 |
|
| 1984 |
+
@keyframes pulse-glow {
|
| 1985 |
+
0%, 100% {
|
| 1986 |
+
opacity: 1;
|
| 1987 |
+
box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
|
| 1988 |
+
}
|
| 1989 |
+
50% {
|
| 1990 |
+
opacity: 0.85;
|
| 1991 |
+
box-shadow: 0 4px 30px rgba(239, 68, 68, 0.6);
|
| 1992 |
+
}
|
| 1993 |
}
|
| 1994 |
|
| 1995 |
+
/* Backend badge with glass effect */
|
| 1996 |
.backend-badge {
|
| 1997 |
display: inline-block;
|
| 1998 |
+
padding: 6px 16px;
|
| 1999 |
+
background: linear-gradient(135deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.8));
|
| 2000 |
+
backdrop-filter: blur(10px);
|
| 2001 |
color: white;
|
| 2002 |
border-radius: 20px;
|
| 2003 |
font-size: 12px;
|
| 2004 |
font-weight: 600;
|
| 2005 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 2006 |
+
box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
|
| 2007 |
+
}
|
| 2008 |
+
|
| 2009 |
+
/* Checkbox styling */
|
| 2010 |
+
.gr-checkbox {
|
| 2011 |
+
background: rgba(255, 255, 255, 0.05) !important;
|
| 2012 |
+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 2013 |
+
border-radius: 8px !important;
|
| 2014 |
+
}
|
| 2015 |
+
|
| 2016 |
+
/* Text input / Textbox */
|
| 2017 |
+
.gr-textbox, .gr-text-input {
|
| 2018 |
+
background: rgba(255, 255, 255, 0.08) !important;
|
| 2019 |
+
backdrop-filter: blur(10px);
|
| 2020 |
+
border: 1px solid rgba(255, 255, 255, 0.15) !important;
|
| 2021 |
+
border-radius: 12px !important;
|
| 2022 |
+
color: rgba(255, 255, 255, 0.9) !important;
|
| 2023 |
}
|
| 2024 |
|
| 2025 |
+
.gr-textbox:focus, .gr-text-input:focus {
|
| 2026 |
+
border-color: rgba(102, 126, 234, 0.5) !important;
|
| 2027 |
+
box-shadow: 0 0 20px rgba(102, 126, 234, 0.2) !important;
|
| 2028 |
+
}
|
| 2029 |
+
|
| 2030 |
+
/* Footer */
|
| 2031 |
.footer {
|
| 2032 |
text-align: center;
|
| 2033 |
margin-top: 2rem;
|
| 2034 |
+
padding: 1.5rem;
|
| 2035 |
+
background: rgba(255, 255, 255, 0.03);
|
| 2036 |
+
backdrop-filter: blur(10px);
|
| 2037 |
+
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
| 2038 |
+
border-radius: 16px;
|
| 2039 |
+
color: rgba(255, 255, 255, 0.6);
|
| 2040 |
+
}
|
| 2041 |
+
|
| 2042 |
+
.footer a {
|
| 2043 |
+
color: #667eea !important;
|
| 2044 |
+
text-decoration: none;
|
| 2045 |
+
transition: color 0.3s ease;
|
| 2046 |
+
}
|
| 2047 |
+
|
| 2048 |
+
.footer a:hover {
|
| 2049 |
+
color: #f093fb !important;
|
| 2050 |
+
}
|
| 2051 |
+
|
| 2052 |
+
/* Info/Stats boxes */
|
| 2053 |
+
.gr-markdown {
|
| 2054 |
+
background: rgba(255, 255, 255, 0.05) !important;
|
| 2055 |
+
backdrop-filter: blur(10px);
|
| 2056 |
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 2057 |
+
border-radius: 16px !important;
|
| 2058 |
+
padding: 20px !important;
|
| 2059 |
+
}
|
| 2060 |
+
|
| 2061 |
+
.gr-markdown blockquote {
|
| 2062 |
+
border-left: 3px solid #667eea !important;
|
| 2063 |
+
background: rgba(102, 126, 234, 0.1) !important;
|
| 2064 |
+
padding: 12px 16px !important;
|
| 2065 |
+
border-radius: 8px !important;
|
| 2066 |
+
}
|
| 2067 |
+
|
| 2068 |
+
/* Scrollbar styling */
|
| 2069 |
+
::-webkit-scrollbar {
|
| 2070 |
+
width: 10px;
|
| 2071 |
+
}
|
| 2072 |
+
|
| 2073 |
+
::-webkit-scrollbar-track {
|
| 2074 |
+
background: rgba(255, 255, 255, 0.05);
|
| 2075 |
+
border-radius: 10px;
|
| 2076 |
+
}
|
| 2077 |
+
|
| 2078 |
+
::-webkit-scrollbar-thumb {
|
| 2079 |
+
background: linear-gradient(135deg, #667eea, #764ba2);
|
| 2080 |
+
border-radius: 10px;
|
| 2081 |
+
border: 2px solid rgba(255, 255, 255, 0.1);
|
| 2082 |
+
}
|
| 2083 |
+
|
| 2084 |
+
::-webkit-scrollbar-thumb:hover {
|
| 2085 |
+
background: linear-gradient(135deg, #764ba2, #f093fb);
|
| 2086 |
+
}
|
| 2087 |
+
|
| 2088 |
+
/* Example cards */
|
| 2089 |
+
.gr-example {
|
| 2090 |
+
background: rgba(255, 255, 255, 0.05) !important;
|
| 2091 |
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 2092 |
+
border-radius: 12px !important;
|
| 2093 |
+
transition: all 0.3s ease !important;
|
| 2094 |
+
}
|
| 2095 |
+
|
| 2096 |
+
.gr-example:hover {
|
| 2097 |
+
background: rgba(255, 255, 255, 0.1) !important;
|
| 2098 |
+
transform: translateY(-2px);
|
| 2099 |
+
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2) !important;
|
| 2100 |
+
}
|
| 2101 |
+
|
| 2102 |
+
/* Floating orbs for extra visual interest */
|
| 2103 |
+
.gradio-container::before,
|
| 2104 |
+
.gradio-container::after {
|
| 2105 |
+
content: '';
|
| 2106 |
+
position: absolute;
|
| 2107 |
+
width: 300px;
|
| 2108 |
+
height: 300px;
|
| 2109 |
+
border-radius: 50%;
|
| 2110 |
+
filter: blur(80px);
|
| 2111 |
+
opacity: 0.3;
|
| 2112 |
+
pointer-events: none;
|
| 2113 |
+
z-index: -1;
|
| 2114 |
+
}
|
| 2115 |
+
|
| 2116 |
+
.gradio-container::before {
|
| 2117 |
+
background: #667eea;
|
| 2118 |
+
top: -100px;
|
| 2119 |
+
left: -100px;
|
| 2120 |
+
animation: float1 8s ease-in-out infinite;
|
| 2121 |
+
}
|
| 2122 |
+
|
| 2123 |
+
.gradio-container::after {
|
| 2124 |
+
background: #f093fb;
|
| 2125 |
+
bottom: -100px;
|
| 2126 |
+
right: -100px;
|
| 2127 |
+
animation: float2 10s ease-in-out infinite;
|
| 2128 |
+
}
|
| 2129 |
+
|
| 2130 |
+
@keyframes float1 {
|
| 2131 |
+
0%, 100% { transform: translate(0, 0); }
|
| 2132 |
+
50% { transform: translate(30px, 30px); }
|
| 2133 |
+
}
|
| 2134 |
+
|
| 2135 |
+
@keyframes float2 {
|
| 2136 |
+
0%, 100% { transform: translate(0, 0); }
|
| 2137 |
+
50% { transform: translate(-30px, -30px); }
|
| 2138 |
}
|
| 2139 |
|
| 2140 |
/* Mobile optimization */
|
| 2141 |
@media (max-width: 768px) {
|
| 2142 |
.gradio-container {
|
| 2143 |
padding: 1rem 0.5rem !important;
|
| 2144 |
+
border-radius: 16px !important;
|
| 2145 |
}
|
| 2146 |
+
|
| 2147 |
.gr-row {
|
| 2148 |
flex-direction: column !important;
|
| 2149 |
}
|
| 2150 |
+
|
| 2151 |
.gr-column {
|
| 2152 |
width: 100% !important;
|
| 2153 |
}
|
| 2154 |
+
|
| 2155 |
+
h1 {
|
| 2156 |
+
font-size: 1.8rem;
|
| 2157 |
+
}
|
| 2158 |
+
|
| 2159 |
+
.gr-button-primary {
|
| 2160 |
+
padding: 10px 20px !important;
|
| 2161 |
+
}
|
| 2162 |
}
|
| 2163 |
"""
|
| 2164 |
|
| 2165 |
with gr.Blocks(
|
| 2166 |
title="StyleForge: Neural Style Transfer",
|
| 2167 |
+
theme=gr.themes.Base(
|
| 2168 |
primary_hue="indigo",
|
| 2169 |
secondary_hue="purple",
|
| 2170 |
+
font=gr.themes.GoogleFont("Inter"),
|
| 2171 |
+
radius_size="lg",
|
| 2172 |
+
).set(
|
| 2173 |
+
# Dark theme colors for glass effect
|
| 2174 |
+
body_background_fill="*background_fill_primary",
|
| 2175 |
+
background_fill_primary="rgba(15, 12, 41, 0.6)",
|
| 2176 |
+
background_fill_secondary="rgba(255, 255, 255, 0.05)",
|
| 2177 |
+
block_background_fill="rgba(255, 255, 255, 0.05)",
|
| 2178 |
+
block_border_width="1px",
|
| 2179 |
+
block_border_color="rgba(255, 255, 255, 0.1)",
|
| 2180 |
+
button_primary_background_fill="linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
|
| 2181 |
+
button_primary_background_fill_hover="linear-gradient(135deg, #764ba2 0%, #667eea 100%)",
|
| 2182 |
+
button_primary_text_color="white",
|
| 2183 |
+
button_primary_border_color="rgba(255, 255, 255, 0.2)",
|
| 2184 |
+
button_secondary_background_fill="rgba(255, 255, 255, 0.1)",
|
| 2185 |
+
button_secondary_background_fill_hover="rgba(255, 255, 255, 0.2)",
|
| 2186 |
+
button_secondary_text_color="rgba(255, 255, 255, 0.9)",
|
| 2187 |
+
button_secondary_border_color="rgba(255, 255, 255, 0.15)",
|
| 2188 |
+
# Text colors
|
| 2189 |
+
body_text_color="rgba(255, 255, 255, 0.85)",
|
| 2190 |
+
body_text_color_subdued="rgba(255, 255, 255, 0.6)",
|
| 2191 |
+
# Input colors
|
| 2192 |
+
input_background_fill="rgba(255, 255, 255, 0.08)",
|
| 2193 |
+
input_background_fill_hover="rgba(255, 255, 255, 0.12)",
|
| 2194 |
+
input_background_fill_focus="rgba(255, 255, 255, 0.15)",
|
| 2195 |
+
input_border_color="rgba(255, 255, 255, 0.15)",
|
| 2196 |
+
input_border_color_focus="#667eea",
|
| 2197 |
+
# Slider colors
|
| 2198 |
+
slider_color="#667eea",
|
| 2199 |
+
# Block shadows for glass depth
|
| 2200 |
+
block_shadow="0 4px 30px rgba(0, 0, 0, 0.1)",
|
| 2201 |
+
block_title_text_color="rgba(255, 255, 255, 0.95)",
|
| 2202 |
+
# Header colors
|
| 2203 |
+
header_background_fill="rgba(255, 255, 255, 0.03)",
|
| 2204 |
+
header_background_fill_dark="rgba(255, 255, 255, 0.03)",
|
| 2205 |
),
|
| 2206 |
css=custom_css
|
| 2207 |
) as demo:
|
|
|
|
| 2209 |
# Header with CUDA badge and dev notice
|
| 2210 |
cuda_badge = f"<span class='backend-badge'>CUDA Available</span>" if CUDA_KERNELS_AVAILABLE else ""
|
| 2211 |
gr.Markdown(f"""
|
| 2212 |
+
<div style="text-align: center; padding: 20px;">
|
| 2213 |
+
<h1 style="font-size: 3rem; margin-bottom: 0.5rem; background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-shadow: 0 0 60px rgba(102, 126, 234, 0.5);">StyleForge</h1>
|
| 2214 |
+
<p style="color: rgba(255, 255, 255, 0.7); font-size: 1.1rem; margin-bottom: 1rem;">✨ Neural Style Transfer with Custom CUDA Kernels ✨</p>
|
| 2215 |
+
{cuda_badge}
|
| 2216 |
+
<p style="color: rgba(255, 255, 255, 0.6); margin-top: 1rem;">
|
| 2217 |
+
<strong style="color: rgba(255, 255, 255, 0.9)">Features:</strong> Custom Styles • Region Transfer • Style Blending • Real-time Processing
|
| 2218 |
+
</p>
|
| 2219 |
+
</div>
|
|
|
|
| 2220 |
""")
|
| 2221 |
|
| 2222 |
# Mode selector
|