Spaces:
Sleeping
Sleeping
github-actions[bot]
commited on
Commit
·
eba3bd7
1
Parent(s):
fc63709
Deploy from GitHub - 2026-01-22 01:08:53
Browse files
app.py
CHANGED
|
@@ -1684,7 +1684,10 @@ def process_webcam_frame(image: Image.Image, style: str, backend: str, intensity
|
|
| 1684 |
|
| 1685 |
return output_image
|
| 1686 |
|
| 1687 |
-
except Exception:
|
|
|
|
|
|
|
|
|
|
| 1688 |
return image
|
| 1689 |
|
| 1690 |
|
|
@@ -1888,14 +1891,17 @@ if SPACES_AVAILABLE:
|
|
| 1888 |
create_style_blend_output = GPU(create_style_blend_output_impl)
|
| 1889 |
apply_region_style = GPU(apply_region_style_impl)
|
| 1890 |
apply_region_style_ui = GPU(apply_region_style_ui_impl)
|
|
|
|
| 1891 |
except Exception:
|
| 1892 |
create_style_blend_output = create_style_blend_output_impl
|
| 1893 |
apply_region_style = apply_region_style_impl
|
| 1894 |
apply_region_style_ui = apply_region_style_ui_impl
|
|
|
|
| 1895 |
else:
|
| 1896 |
create_style_blend_output = create_style_blend_output_impl
|
| 1897 |
apply_region_style = apply_region_style_impl
|
| 1898 |
apply_region_style_ui = apply_region_style_ui_impl
|
|
|
|
| 1899 |
|
| 1900 |
|
| 1901 |
# ============================================================================
|
|
@@ -2138,6 +2144,92 @@ select:focus {
|
|
| 2138 |
outline: none !important;
|
| 2139 |
}
|
| 2140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2141 |
/* Image containers - glass frame */
|
| 2142 |
.image-container,
|
| 2143 |
[class*="image"] {
|
|
@@ -2366,6 +2458,41 @@ button[class*="Primary"],
|
|
| 2366 |
margin: 8px 0 !important;
|
| 2367 |
}
|
| 2368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2369 |
/* Block containers */
|
| 2370 |
.block {
|
| 2371 |
background: rgba(255, 255, 255, 0.25) !important;
|
|
@@ -2825,22 +2952,10 @@ with gr.Blocks(
|
|
| 2825 |
# Pre-styled example outputs for display
|
| 2826 |
# These images demonstrate each style without needing to run the model
|
| 2827 |
gr.Markdown("### Quick Style Examples")
|
| 2828 |
-
gr.Markdown("
|
| 2829 |
-
|
| 2830 |
-
|
| 2831 |
-
|
| 2832 |
-
[example_img, "candy", "auto", 70, False, False],
|
| 2833 |
-
[example_img, "mosaic", "auto", 70, False, False],
|
| 2834 |
-
[example_img, "rain_princess", "auto", 70, True, False],
|
| 2835 |
-
[example_img, "udnie", "auto", 70, False, False],
|
| 2836 |
-
[example_img, "starry_night", "auto", 70, False, False],
|
| 2837 |
-
[example_img, "la_muse", "auto", 70, False, False],
|
| 2838 |
-
[example_img, "the_scream", "auto", 70, False, False],
|
| 2839 |
-
[example_img, "composition_vii", "auto", 70, False, False],
|
| 2840 |
-
],
|
| 2841 |
-
inputs=[quick_image, quick_style, quick_backend, quick_intensity, quick_compare, quick_watermark],
|
| 2842 |
-
label="Style Presets (click to load)"
|
| 2843 |
-
)
|
| 2844 |
|
| 2845 |
# Display example style gallery with unique gradients for each style
|
| 2846 |
gr.Markdown("""
|
|
|
|
| 1684 |
|
| 1685 |
return output_image
|
| 1686 |
|
| 1687 |
+
except Exception as e:
|
| 1688 |
+
print(f"Webcam processing error: {e}")
|
| 1689 |
+
import traceback
|
| 1690 |
+
traceback.print_exc()
|
| 1691 |
return image
|
| 1692 |
|
| 1693 |
|
|
|
|
| 1891 |
create_style_blend_output = GPU(create_style_blend_output_impl)
|
| 1892 |
apply_region_style = GPU(apply_region_style_impl)
|
| 1893 |
apply_region_style_ui = GPU(apply_region_style_ui_impl)
|
| 1894 |
+
process_webcam_frame = GPU(process_webcam_frame)
|
| 1895 |
except Exception:
|
| 1896 |
create_style_blend_output = create_style_blend_output_impl
|
| 1897 |
apply_region_style = apply_region_style_impl
|
| 1898 |
apply_region_style_ui = apply_region_style_ui_impl
|
| 1899 |
+
process_webcam_frame = process_webcam_frame
|
| 1900 |
else:
|
| 1901 |
create_style_blend_output = create_style_blend_output_impl
|
| 1902 |
apply_region_style = apply_region_style_impl
|
| 1903 |
apply_region_style_ui = apply_region_style_ui_impl
|
| 1904 |
+
process_webcam_frame = process_webcam_frame
|
| 1905 |
|
| 1906 |
|
| 1907 |
# ============================================================================
|
|
|
|
| 2144 |
outline: none !important;
|
| 2145 |
}
|
| 2146 |
|
| 2147 |
+
/* Dropdown menu fixes */
|
| 2148 |
+
.gradio-dropdown,
|
| 2149 |
+
.dropdown,
|
| 2150 |
+
[class*="dropdown"],
|
| 2151 |
+
[class*="Dropdown"] {
|
| 2152 |
+
position: relative !important;
|
| 2153 |
+
z-index: 100 !important;
|
| 2154 |
+
}
|
| 2155 |
+
|
| 2156 |
+
/* Dropdown menu/option list positioning */
|
| 2157 |
+
.gradio-dropdown ul,
|
| 2158 |
+
.dropdown ul,
|
| 2159 |
+
select option,
|
| 2160 |
+
[class*="dropdown"] ul,
|
| 2161 |
+
[class*="Dropdown"] ul {
|
| 2162 |
+
position: absolute !important;
|
| 2163 |
+
z-index: 9999 !important;
|
| 2164 |
+
background: rgba(255, 255, 255, 0.95) !important;
|
| 2165 |
+
backdrop-filter: blur(20px) !important;
|
| 2166 |
+
border: 1px solid rgba(255, 255, 255, 0.5) !important;
|
| 2167 |
+
border-radius: 12px !important;
|
| 2168 |
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
|
| 2169 |
+
max-height: 300px !important;
|
| 2170 |
+
overflow-y: auto !important;
|
| 2171 |
+
}
|
| 2172 |
+
|
| 2173 |
+
/* Gradio 5.x dropdown container fixes */
|
| 2174 |
+
[class*="svelte"][class*="dropdown"],
|
| 2175 |
+
[class*="svelte"][class*="radio"],
|
| 2176 |
+
[class*="svelte"][class*="radio-item"] {
|
| 2177 |
+
position: relative !important;
|
| 2178 |
+
z-index: 100 !important;
|
| 2179 |
+
}
|
| 2180 |
+
|
| 2181 |
+
/* Radio button group positioning */
|
| 2182 |
+
.gradio-radio,
|
| 2183 |
+
[class*="radio"] {
|
| 2184 |
+
position: relative !important;
|
| 2185 |
+
z-index: 50 !important;
|
| 2186 |
+
}
|
| 2187 |
+
|
| 2188 |
+
/* Fix for Gradio 5.x dropdown positioning - ensure dropdown appears above/below button */
|
| 2189 |
+
[class*="svelte"] {
|
| 2190 |
+
position: relative !important;
|
| 2191 |
+
}
|
| 2192 |
+
|
| 2193 |
+
/* Dropdown list/popover positioning */
|
| 2194 |
+
[class*="popover"],
|
| 2195 |
+
[class*="popover"],
|
| 2196 |
+
[class*="menu"],
|
| 2197 |
+
[class*="dropdown-menu"],
|
| 2198 |
+
[class*="options"] {
|
| 2199 |
+
position: absolute !important;
|
| 2200 |
+
z-index: 9999 !important;
|
| 2201 |
+
background: rgba(255, 255, 255, 0.98) !important;
|
| 2202 |
+
backdrop-filter: blur(20px) saturate(180%) !important;
|
| 2203 |
+
border: 1px solid rgba(255, 255, 255, 0.6) !important;
|
| 2204 |
+
border-radius: 14px !important;
|
| 2205 |
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2) !important;
|
| 2206 |
+
max-height: 350px !important;
|
| 2207 |
+
overflow-y: auto !important;
|
| 2208 |
+
min-width: 200px !important;
|
| 2209 |
+
}
|
| 2210 |
+
|
| 2211 |
+
/* Dropdown option items */
|
| 2212 |
+
[class*="popover"] [class*="item"],
|
| 2213 |
+
[class*="menu"] [class*="item"],
|
| 2214 |
+
[class*="dropdown-menu"] [class*="item"],
|
| 2215 |
+
[class*="options"] [class*="item"],
|
| 2216 |
+
li[class*="option"] {
|
| 2217 |
+
padding: 12px 16px !important;
|
| 2218 |
+
cursor: pointer !important;
|
| 2219 |
+
transition: all 0.2s ease !important;
|
| 2220 |
+
border-radius: 8px !important;
|
| 2221 |
+
margin: 4px 8px !important;
|
| 2222 |
+
font-family: 'Plus Jakarta Sans', sans-serif !important;
|
| 2223 |
+
}
|
| 2224 |
+
|
| 2225 |
+
[class*="popover"] [class*="item"]:hover,
|
| 2226 |
+
[class*="menu"] [class*="item"]:hover,
|
| 2227 |
+
[class*="dropdown-menu"] [class*="item"]:hover,
|
| 2228 |
+
[class*="options"] [class*="item"]:hover,
|
| 2229 |
+
li[class*="option"]:hover {
|
| 2230 |
+
background: rgba(99, 102, 241, 0.1) !important;
|
| 2231 |
+
}
|
| 2232 |
+
|
| 2233 |
/* Image containers - glass frame */
|
| 2234 |
.image-container,
|
| 2235 |
[class*="image"] {
|
|
|
|
| 2458 |
margin: 8px 0 !important;
|
| 2459 |
}
|
| 2460 |
|
| 2461 |
+
/* Gradio 5.x Portal/Popover fixes for dropdowns */
|
| 2462 |
+
div[id*="root"] > div,
|
| 2463 |
+
div[data-testid*="dropdown"],
|
| 2464 |
+
div[role="listbox"],
|
| 2465 |
+
div[role="option"] {
|
| 2466 |
+
position: relative !important;
|
| 2467 |
+
}
|
| 2468 |
+
|
| 2469 |
+
/* Fixed position dropdowns (Gradio 5.x uses portals) */
|
| 2470 |
+
body > div[id*="portal"],
|
| 2471 |
+
body > div[class*="popover"],
|
| 2472 |
+
body > div[class*="dropdown"] {
|
| 2473 |
+
position: fixed !important;
|
| 2474 |
+
z-index: 99999 !important;
|
| 2475 |
+
margin-top: 0 !important;
|
| 2476 |
+
padding-top: 0 !important;
|
| 2477 |
+
}
|
| 2478 |
+
|
| 2479 |
+
/* Dropdown list - reduce gap below button */
|
| 2480 |
+
.gradio-dropdown ul,
|
| 2481 |
+
.dropdown ul,
|
| 2482 |
+
[class*="dropdown"] ul,
|
| 2483 |
+
[role="listbox"] {
|
| 2484 |
+
margin-top: 4px !important;
|
| 2485 |
+
top: auto !important;
|
| 2486 |
+
}
|
| 2487 |
+
|
| 2488 |
+
/* Dropdown button itself - ensure it has proper spacing */
|
| 2489 |
+
.gradio-dropdown > div,
|
| 2490 |
+
[class*="dropdown"] > div {
|
| 2491 |
+
min-height: 48px !important;
|
| 2492 |
+
padding: 12px 16px !important;
|
| 2493 |
+
margin-bottom: 0 !important;
|
| 2494 |
+
}
|
| 2495 |
+
|
| 2496 |
/* Block containers */
|
| 2497 |
.block {
|
| 2498 |
background: rgba(255, 255, 255, 0.25) !important;
|
|
|
|
| 2952 |
# Pre-styled example outputs for display
|
| 2953 |
# These images demonstrate each style without needing to run the model
|
| 2954 |
gr.Markdown("### Quick Style Examples")
|
| 2955 |
+
gr.Markdown("Upload an image and select a style to see the transformation in action!")
|
| 2956 |
+
|
| 2957 |
+
# Examples removed - they all showed the same input image
|
| 2958 |
+
# The style gallery below shows visual representations of each style
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2959 |
|
| 2960 |
# Display example style gallery with unique gradients for each style
|
| 2961 |
gr.Markdown("""
|