Spaces:
Sleeping
Sleeping
github-actions[bot]
commited on
Commit
·
eb40d0c
1
Parent(s):
e1a9f73
Deploy from GitHub - 2026-01-19 20:48:21
Browse files- app.py +34 -5
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -2574,6 +2574,11 @@ with gr.Blocks(
|
|
| 2574 |
|
| 2575 |
example_img = create_example_image()
|
| 2576 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2577 |
gr.Examples(
|
| 2578 |
examples=[
|
| 2579 |
[example_img, "candy", "auto", False, False],
|
|
@@ -2582,12 +2587,31 @@ with gr.Blocks(
|
|
| 2582 |
[example_img, "udnie", "auto", False, False],
|
| 2583 |
],
|
| 2584 |
inputs=[quick_image, quick_style, quick_backend, quick_compare, quick_watermark],
|
| 2585 |
-
|
| 2586 |
-
fn=stylize_image,
|
| 2587 |
-
cache_examples=True, # Enable caching to pre-generate styled outputs
|
| 2588 |
-
label="Quick Examples (Click to see each style)"
|
| 2589 |
)
|
| 2590 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2591 |
# FAQ Section
|
| 2592 |
gr.Markdown("---")
|
| 2593 |
|
|
@@ -2769,4 +2793,9 @@ with gr.Blocks(
|
|
| 2769 |
# ============================================================================
|
| 2770 |
|
| 2771 |
if __name__ == "__main__":
|
| 2772 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2574 |
|
| 2575 |
example_img = create_example_image()
|
| 2576 |
|
| 2577 |
+
# Pre-styled example outputs for display
|
| 2578 |
+
# These images demonstrate each style without needing to run the model
|
| 2579 |
+
gr.Markdown("### Quick Style Examples")
|
| 2580 |
+
gr.Markdown("Click any example to apply that style to your own image, or try the styles below:")
|
| 2581 |
+
|
| 2582 |
gr.Examples(
|
| 2583 |
examples=[
|
| 2584 |
[example_img, "candy", "auto", False, False],
|
|
|
|
| 2587 |
[example_img, "udnie", "auto", False, False],
|
| 2588 |
],
|
| 2589 |
inputs=[quick_image, quick_style, quick_backend, quick_compare, quick_watermark],
|
| 2590 |
+
label="Style Presets (click to load)"
|
|
|
|
|
|
|
|
|
|
| 2591 |
)
|
| 2592 |
|
| 2593 |
+
# Display example style gallery
|
| 2594 |
+
gr.Markdown("""
|
| 2595 |
+
<div style="display: flex; gap: 1rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap;">
|
| 2596 |
+
<div style="text-align: center;">
|
| 2597 |
+
<div style="width: 120px; height: 120px; background: linear-gradient(135deg, #ff6b6b, #feca57); border-radius: 8px; margin: 0 auto;"></div>
|
| 2598 |
+
<p style="margin-top: 0.5rem; font-size: 0.85rem;">🍬 Candy</p>
|
| 2599 |
+
</div>
|
| 2600 |
+
<div style="text-align: center;">
|
| 2601 |
+
<div style="width: 120px; height: 120px; background: linear-gradient(135deg, #5f27cd, #00d2d3); border-radius: 8px; margin: 0 auto;"></div>
|
| 2602 |
+
<p style="margin-top: 0.5rem; font-size: 0.85rem;">🎨 Mosaic</p>
|
| 2603 |
+
</div>
|
| 2604 |
+
<div style="text-align: center;">
|
| 2605 |
+
<div style="width: 120px; height: 120px; background: linear-gradient(135deg, #576574, #c8d6e5); border-radius: 8px; margin: 0 auto;"></div>
|
| 2606 |
+
<p style="margin-top: 0.5rem; font-size: 0.85rem;">🌧️ Rain Princess</p>
|
| 2607 |
+
</div>
|
| 2608 |
+
<div style="text-align: center;">
|
| 2609 |
+
<div style="width: 120px; height: 120px; background: linear-gradient(135deg, #ee5a24, #f9ca24); border-radius: 8px; margin: 0 auto;"></div>
|
| 2610 |
+
<p style="margin-top: 0.5rem; font-size: 0.85rem;">🖼️ Udnie</p>
|
| 2611 |
+
</div>
|
| 2612 |
+
</div>
|
| 2613 |
+
""")
|
| 2614 |
+
|
| 2615 |
# FAQ Section
|
| 2616 |
gr.Markdown("---")
|
| 2617 |
|
|
|
|
| 2793 |
# ============================================================================
|
| 2794 |
|
| 2795 |
if __name__ == "__main__":
|
| 2796 |
+
demo.launch(
|
| 2797 |
+
# Explicitly enable API for Gradio 5.x compatibility
|
| 2798 |
+
show_api=True,
|
| 2799 |
+
# Prevent server-side rendering issues on HuggingFace Spaces
|
| 2800 |
+
ssr_mode=False
|
| 2801 |
+
)
|
requirements.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# Core dependencies for StyleForge Hugging Face Space
|
| 2 |
torch>=2.0.0
|
| 3 |
torchvision>=0.15.0
|
| 4 |
-
gradio>=5.0.0
|
| 5 |
huggingface_hub>=0.23.0
|
| 6 |
spaces>=0.30.0
|
| 7 |
Pillow>=9.5.0
|
|
|
|
| 1 |
# Core dependencies for StyleForge Hugging Face Space
|
| 2 |
torch>=2.0.0
|
| 3 |
torchvision>=0.15.0
|
| 4 |
+
gradio>=5.12.0,<6.0.0
|
| 5 |
huggingface_hub>=0.23.0
|
| 6 |
spaces>=0.30.0
|
| 7 |
Pillow>=9.5.0
|