Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1764,7 +1764,7 @@ Snapchat - bright colors, fun filters, youthful design""",
|
|
| 1764 |
|
| 1765 |
# Background Gallery Section
|
| 1766 |
gr.Markdown("---")
|
| 1767 |
-
with gr.Accordion("π¨ Background Gallery (30 Backgrounds)", open=
|
| 1768 |
gr.Markdown("""
|
| 1769 |
Esplora tutti i 30 background disponibili organizzati per categoria.
|
| 1770 |
Usa questa gallery per analizzare visualmente la knowledge base e testare ogni background.
|
|
@@ -1773,9 +1773,13 @@ Snapchat - bright colors, fun filters, youthful design""",
|
|
| 1773 |
# Refresh button to update with new theme
|
| 1774 |
refresh_backgrounds_btn = gr.Button("π Aggiorna con Tema Corrente", variant="secondary", size="sm")
|
| 1775 |
|
| 1776 |
-
# Gallery HTML (reactive to theme changes)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1777 |
gallery_html = gr.HTML(
|
| 1778 |
-
value=
|
| 1779 |
)
|
| 1780 |
|
| 1781 |
# Connect refresh button
|
|
@@ -1785,65 +1789,6 @@ Snapchat - bright colors, fun filters, youthful design""",
|
|
| 1785 |
outputs=[gallery_html]
|
| 1786 |
)
|
| 1787 |
|
| 1788 |
-
# Background selection dropdown
|
| 1789 |
-
bg_selector = gr.Dropdown(
|
| 1790 |
-
label="Oppure seleziona direttamente:",
|
| 1791 |
-
choices=[
|
| 1792 |
-
("Linear Gradient", "gradient_linear"),
|
| 1793 |
-
("Radial Gradient", "gradient_radial"),
|
| 1794 |
-
("Angular Gradient", "gradient_angular"),
|
| 1795 |
-
("Sweep Gradient", "gradient_sweep"),
|
| 1796 |
-
("Mesh Gradient", "gradient_mesh"),
|
| 1797 |
-
("Diagonal Gradient", "gradient_diagonal"),
|
| 1798 |
-
("Smooth Waves", "waves_smooth"),
|
| 1799 |
-
("Sharp Waves", "waves_sharp"),
|
| 1800 |
-
("Layered Waves", "waves_layered"),
|
| 1801 |
-
("Curved Waves", "waves_curved"),
|
| 1802 |
-
("Minimal Wave", "waves_minimal"),
|
| 1803 |
-
("Floating Circles", "geometric_circles"),
|
| 1804 |
-
("Triangle Pattern", "geometric_triangles"),
|
| 1805 |
-
("Hexagon Grid", "geometric_hexagons"),
|
| 1806 |
-
("Dot Grid", "geometric_grid"),
|
| 1807 |
-
("Diagonal Stripes", "geometric_stripes"),
|
| 1808 |
-
("Diamond Shapes", "geometric_diamonds"),
|
| 1809 |
-
("Blob Shapes", "organic_blobs"),
|
| 1810 |
-
("Fluid Effect", "organic_fluid"),
|
| 1811 |
-
("Noise Texture", "organic_noise"),
|
| 1812 |
-
("Cloud Shapes", "organic_clouds"),
|
| 1813 |
-
("Dot Pattern", "pattern_dots"),
|
| 1814 |
-
("Line Pattern", "pattern_lines"),
|
| 1815 |
-
("Chevron Pattern", "pattern_chevron"),
|
| 1816 |
-
("Zigzag Pattern", "pattern_zigzag"),
|
| 1817 |
-
("Crystalline", "abstract_crystalline"),
|
| 1818 |
-
("Voronoi Diagram", "abstract_voronoi"),
|
| 1819 |
-
("Particle Field", "abstract_particles"),
|
| 1820 |
-
("Light Rays", "abstract_rays"),
|
| 1821 |
-
("Star Constellation", "abstract_constellation"),
|
| 1822 |
-
],
|
| 1823 |
-
value=None,
|
| 1824 |
-
interactive=True
|
| 1825 |
-
)
|
| 1826 |
-
|
| 1827 |
-
generate_bg_btn = gr.Button("π Genera Preview Background", variant="primary")
|
| 1828 |
-
|
| 1829 |
-
# Preview area
|
| 1830 |
-
gr.Markdown("### π± Preview")
|
| 1831 |
-
bg_preview_info = gr.HTML(
|
| 1832 |
-
value="<p id='bg-preview-area' style='text-align: center; color: #999; padding: 20px;'>Seleziona un background e clicca 'Genera Preview'...</p>"
|
| 1833 |
-
)
|
| 1834 |
-
bg_preview_code = gr.Code(
|
| 1835 |
-
label="Dart Code - Background Only",
|
| 1836 |
-
language="javascript",
|
| 1837 |
-
lines=20,
|
| 1838 |
-
value=""
|
| 1839 |
-
)
|
| 1840 |
-
|
| 1841 |
-
# Connect button
|
| 1842 |
-
generate_bg_btn.click(
|
| 1843 |
-
fn=generate_single_background_preview,
|
| 1844 |
-
inputs=[bg_selector],
|
| 1845 |
-
outputs=[bg_preview_code, bg_preview_info]
|
| 1846 |
-
)
|
| 1847 |
|
| 1848 |
# Connect button
|
| 1849 |
generate_flutter_btn.click(
|
|
|
|
| 1764 |
|
| 1765 |
# Background Gallery Section
|
| 1766 |
gr.Markdown("---")
|
| 1767 |
+
with gr.Accordion("π¨ Background Gallery (30 Backgrounds)", open=True):
|
| 1768 |
gr.Markdown("""
|
| 1769 |
Esplora tutti i 30 background disponibili organizzati per categoria.
|
| 1770 |
Usa questa gallery per analizzare visualmente la knowledge base e testare ogni background.
|
|
|
|
| 1773 |
# Refresh button to update with new theme
|
| 1774 |
refresh_backgrounds_btn = gr.Button("π Aggiorna con Tema Corrente", variant="secondary", size="sm")
|
| 1775 |
|
| 1776 |
+
# Gallery HTML (reactive to theme changes) - show immediately with default theme
|
| 1777 |
+
default_theme_for_gallery = json.dumps({
|
| 1778 |
+
"name": "Default Theme",
|
| 1779 |
+
"palette": {"primary": "#2196F3", "secondary": "#FF9800", "accent": "#4CAF50"}
|
| 1780 |
+
})
|
| 1781 |
gallery_html = gr.HTML(
|
| 1782 |
+
value=generate_background_gallery(default_theme_for_gallery)
|
| 1783 |
)
|
| 1784 |
|
| 1785 |
# Connect refresh button
|
|
|
|
| 1789 |
outputs=[gallery_html]
|
| 1790 |
)
|
| 1791 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1792 |
|
| 1793 |
# Connect button
|
| 1794 |
generate_flutter_btn.click(
|