shayekh commited on
Commit
4f19df6
Β·
verified Β·
1 Parent(s): f1b7f98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +209 -19
app.py CHANGED
@@ -1693,25 +1693,25 @@ def create_demo():
1693
  )
1694
 
1695
  css = """
1696
- /* Animated Background Styling */
1697
  @keyframes gradientBG {
1698
  0% { background-position: 0% 50%; }
1699
  50% { background-position: 100% 50%; }
1700
  100% { background-position: 0% 50%; }
1701
  }
1702
-
1703
  body, .gradio-container {
1704
  background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #1a2a6c, #112240) !important;
1705
  background-size: 400% 400% !important;
1706
  animation: gradientBG 15s ease infinite !important;
1707
  background-attachment: fixed !important;
1708
- color: #f8fafc !important;
1709
  font-family: 'Outfit', sans-serif !important;
1710
  }
1711
-
1712
- /* Advanced Glassmorphism Panels */
1713
- .gradio-container .form,
1714
- .gradio-container .panel,
1715
  .gradio-container .box {
1716
  background: rgba(15, 23, 42, 0.4) !important;
1717
  backdrop-filter: blur(20px) !important;
@@ -1721,7 +1721,26 @@ def create_demo():
1721
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
1722
  }
1723
 
1724
- /* Headings */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1725
  h1 {
1726
  text-align: center;
1727
  background: linear-gradient(to right, #c084fc, #60a5fa);
@@ -1733,8 +1752,112 @@ def create_demo():
1733
  text-shadow: 0px 4px 30px rgba(192, 132, 252, 0.3);
1734
  letter-spacing: -1px;
1735
  }
1736
-
1737
- /* Buttons */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1738
  button.primary {
1739
  background: linear-gradient(135deg, #8b5cf6, #3b82f6) !important;
1740
  border: none !important;
@@ -1750,6 +1873,20 @@ def create_demo():
1750
  transform: translateY(-3px) scale(1.02) !important;
1751
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.8) !important;
1752
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1753
  button.stop {
1754
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
1755
  border: none !important;
@@ -1765,8 +1902,8 @@ def create_demo():
1765
  transform: translateY(-3px) scale(1.02) !important;
1766
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.8) !important;
1767
  }
1768
-
1769
- /* Inputs */
1770
  textarea, input[type="text"], input[type="number"], select {
1771
  background: rgba(0, 0, 0, 0.3) !important;
1772
  border: 1px solid rgba(255,255,255,0.1) !important;
@@ -1778,18 +1915,71 @@ def create_demo():
1778
  border-color: #a855f7 !important;
1779
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4), inset 0 0 0 1px rgba(168, 85, 247, 0.4) !important;
1780
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1781
 
1782
- /* Hide Stream Box Duplicate Progress */
1783
- #stream_box .progress-text,
1784
- #stream_box .progress-level,
1785
- #stream_box .progress,
1786
- #stream_box .progress-container {
1787
- display: none !important;
1788
  }
 
 
 
 
1789
  """
1790
 
1791
  with gr.Blocks(title="LocalDuo", theme=custom_theme, css=css) as demo:
1792
- gr.Markdown("# πŸ‡°πŸ‡·βœ¨ LocalDuo - Learn Korean from PDFs, Websites & YouTube")
1793
  gr.Markdown("Enter a website URL 🌐, upload a PDF πŸ“„, upload an audio file 🎡, or paste a YouTube link 🎬. The app uses a **Vision-Language Model (VLM)** 🧠, **ASR** 🎀, and **TTS** πŸ—£οΈ to generate vocabulary flashcards.")
1794
 
1795
  active_tab = gr.State("Website URL")
 
1693
  )
1694
 
1695
  css = """
1696
+ /* ── Animated Background ── */
1697
  @keyframes gradientBG {
1698
  0% { background-position: 0% 50%; }
1699
  50% { background-position: 100% 50%; }
1700
  100% { background-position: 0% 50%; }
1701
  }
1702
+
1703
  body, .gradio-container {
1704
  background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #1a2a6c, #112240) !important;
1705
  background-size: 400% 400% !important;
1706
  animation: gradientBG 15s ease infinite !important;
1707
  background-attachment: fixed !important;
1708
+ color: #e2e8f0 !important;
1709
  font-family: 'Outfit', sans-serif !important;
1710
  }
1711
+
1712
+ /* ── Glassmorphism Panels ── */
1713
+ .gradio-container .form,
1714
+ .gradio-container .panel,
1715
  .gradio-container .box {
1716
  background: rgba(15, 23, 42, 0.4) !important;
1717
  backdrop-filter: blur(20px) !important;
 
1721
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
1722
  }
1723
 
1724
+ /* ── GLOBAL TEXT OVERRIDES (Dark Theme) ── */
1725
+ /* Force ALL text to be light on dark background */
1726
+ .gradio-container label,
1727
+ .gradio-container .label-wrap,
1728
+ .gradio-container .label-wrap span,
1729
+ .gradio-container span,
1730
+ .gradio-container p,
1731
+ .gradio-container h2,
1732
+ .gradio-container h3,
1733
+ .gradio-container h4,
1734
+ .gradio-container h5,
1735
+ .gradio-container h6,
1736
+ .gradio-container .prose,
1737
+ .gradio-container .prose *,
1738
+ .gradio-container .block label span,
1739
+ .gradio-container .block .label-wrap span {
1740
+ color: #e2e8f0 !important;
1741
+ }
1742
+
1743
+ /* ── Headings ── */
1744
  h1 {
1745
  text-align: center;
1746
  background: linear-gradient(to right, #c084fc, #60a5fa);
 
1752
  text-shadow: 0px 4px 30px rgba(192, 132, 252, 0.3);
1753
  letter-spacing: -1px;
1754
  }
1755
+ /* Restore emoji visibility inside gradient headings */
1756
+ h1 .emoji {
1757
+ -webkit-text-fill-color: initial;
1758
+ font-style: normal;
1759
+ }
1760
+
1761
+ /* ── TAB LABELS (critical fix) ── */
1762
+ .gradio-container .tabs .tab-nav button {
1763
+ color: #94a3b8 !important;
1764
+ font-weight: 600 !important;
1765
+ font-size: 14px !important;
1766
+ padding: 10px 16px !important;
1767
+ background: transparent !important;
1768
+ border: none !important;
1769
+ border-bottom: 2px solid transparent !important;
1770
+ transition: all 0.25s ease !important;
1771
+ }
1772
+ .gradio-container .tabs .tab-nav button.selected,
1773
+ .gradio-container .tabs .tab-nav button[aria-selected="true"] {
1774
+ color: #c084fc !important;
1775
+ border-bottom-color: #8b5cf6 !important;
1776
+ background: rgba(139, 92, 246, 0.1) !important;
1777
+ }
1778
+ .gradio-container .tabs .tab-nav button:hover {
1779
+ color: #e2e8f0 !important;
1780
+ background: rgba(255, 255, 255, 0.05) !important;
1781
+ }
1782
+
1783
+ /* ── SLIDER / RANGE LABELS ── */
1784
+ .gradio-container input[type="range"] + .rangeSlider,
1785
+ .gradio-container .range-slider,
1786
+ .gradio-container input[type="number"] {
1787
+ color: #e2e8f0 !important;
1788
+ }
1789
+ /* Slider min/max number labels */
1790
+ .gradio-container .wrap.default span,
1791
+ .gradio-container .head span,
1792
+ .gradio-container .range_slider span {
1793
+ color: #94a3b8 !important;
1794
+ }
1795
+
1796
+ /* ── ACCORDION HEADERS ── */
1797
+ .gradio-container .accordion > button,
1798
+ .gradio-container .accordion > .label-wrap,
1799
+ .gradio-container details > summary,
1800
+ .gradio-container details > summary span {
1801
+ color: #e2e8f0 !important;
1802
+ font-weight: 600 !important;
1803
+ }
1804
+
1805
+ /* ── MARKDOWN / PROSE ── */
1806
+ .gradio-container .md,
1807
+ .gradio-container .md p,
1808
+ .gradio-container .md li,
1809
+ .gradio-container .md strong,
1810
+ .gradio-container .md em,
1811
+ .gradio-container .md h3,
1812
+ .gradio-container .md h2 {
1813
+ color: #cbd5e1 !important;
1814
+ }
1815
+ .gradio-container .md strong {
1816
+ color: #f1f5f9 !important;
1817
+ }
1818
+ .gradio-container .md a {
1819
+ color: #60a5fa !important;
1820
+ }
1821
+ /* Subheading markdown like "### βš™οΈ Customization Settings" */
1822
+ .gradio-container .prose h3,
1823
+ .gradio-container h3 {
1824
+ color: #c084fc !important;
1825
+ font-weight: 700 !important;
1826
+ font-size: 1.05em !important;
1827
+ }
1828
+
1829
+ /* ── HINT TEXT (small italic helpers) ── */
1830
+ .hint-text, .hint-text p, .hint-text * {
1831
+ color: #64748b !important;
1832
+ font-size: 13px !important;
1833
+ }
1834
+
1835
+ /* ── FILE UPLOAD ── */
1836
+ .gradio-container .file-upload,
1837
+ .gradio-container .upload-button,
1838
+ .gradio-container .file-preview {
1839
+ background: rgba(0, 0, 0, 0.2) !important;
1840
+ border: 1px dashed rgba(255, 255, 255, 0.15) !important;
1841
+ color: #94a3b8 !important;
1842
+ border-radius: 12px !important;
1843
+ }
1844
+
1845
+ /* ── DROPDOWN / SELECT ── */
1846
+ .gradio-container .dropdown-container,
1847
+ .gradio-container .secondary-wrap,
1848
+ .gradio-container ul[role="listbox"] {
1849
+ background: rgba(15, 23, 42, 0.95) !important;
1850
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
1851
+ color: #e2e8f0 !important;
1852
+ }
1853
+ .gradio-container ul[role="listbox"] li {
1854
+ color: #e2e8f0 !important;
1855
+ }
1856
+ .gradio-container ul[role="listbox"] li:hover {
1857
+ background: rgba(139, 92, 246, 0.2) !important;
1858
+ }
1859
+
1860
+ /* ── BUTTONS ── */
1861
  button.primary {
1862
  background: linear-gradient(135deg, #8b5cf6, #3b82f6) !important;
1863
  border: none !important;
 
1873
  transform: translateY(-3px) scale(1.02) !important;
1874
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.8) !important;
1875
  }
1876
+ button.secondary {
1877
+ background: rgba(100, 116, 139, 0.2) !important;
1878
+ border: 1px solid rgba(100, 116, 139, 0.4) !important;
1879
+ color: #e2e8f0 !important;
1880
+ border-radius: 14px !important;
1881
+ font-weight: 600 !important;
1882
+ transition: all 0.25s ease !important;
1883
+ }
1884
+ button.secondary:hover {
1885
+ background: rgba(100, 116, 139, 0.35) !important;
1886
+ border-color: rgba(139, 92, 246, 0.5) !important;
1887
+ color: #f8fafc !important;
1888
+ transform: translateY(-2px) !important;
1889
+ }
1890
  button.stop {
1891
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
1892
  border: none !important;
 
1902
  transform: translateY(-3px) scale(1.02) !important;
1903
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.8) !important;
1904
  }
1905
+
1906
+ /* ── INPUTS ── */
1907
  textarea, input[type="text"], input[type="number"], select {
1908
  background: rgba(0, 0, 0, 0.3) !important;
1909
  border: 1px solid rgba(255,255,255,0.1) !important;
 
1915
  border-color: #a855f7 !important;
1916
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4), inset 0 0 0 1px rgba(168, 85, 247, 0.4) !important;
1917
  }
1918
+ /* Textbox label */
1919
+ .gradio-container .textbox label span,
1920
+ .gradio-container .input-label {
1921
+ color: #c084fc !important;
1922
+ font-weight: 600 !important;
1923
+ }
1924
+
1925
+ /* ── EXPORT / DOWNLOAD FILE COMPONENT ── */
1926
+ .gradio-container .download,
1927
+ .gradio-container .file a {
1928
+ color: #60a5fa !important;
1929
+ }
1930
+
1931
+ /* ── GALLERY ── */
1932
+ .gradio-container .gallery-item {
1933
+ background: rgba(0, 0, 0, 0.3) !important;
1934
+ border: 1px solid rgba(255, 255, 255, 0.08) !important;
1935
+ border-radius: 12px !important;
1936
+ }
1937
+
1938
+ /* ── INFO / TOOLTIP TEXT ── */
1939
+ .gradio-container .info,
1940
+ .gradio-container .wrap .info {
1941
+ color: #64748b !important;
1942
+ }
1943
+
1944
+ /* ── BLOCK BACKGROUNDS (inner panels) ── */
1945
+ .gradio-container .block {
1946
+ background: transparent !important;
1947
+ }
1948
+ .gradio-container .contain {
1949
+ background: transparent !important;
1950
+ }
1951
+ /* Tab panel content area */
1952
+ .gradio-container .tabitem {
1953
+ background: transparent !important;
1954
+ }
1955
+
1956
+ /* ── AUDIO PLAYER ── */
1957
+ .gradio-container audio {
1958
+ filter: invert(0.85) hue-rotate(180deg);
1959
+ border-radius: 8px;
1960
+ }
1961
+
1962
+ /* ── Hide Stream Box Duplicate Progress ── */
1963
+ #stream_box .progress-text,
1964
+ #stream_box .progress-level,
1965
+ #stream_box .progress,
1966
+ #stream_box .progress-container {
1967
+ display: none !important;
1968
+ }
1969
 
1970
+ /* ── SCROLLBAR (Firefox + Chrome) ── */
1971
+ * {
1972
+ scrollbar-width: thin;
1973
+ scrollbar-color: rgba(139, 92, 246, 0.4) transparent;
 
 
1974
  }
1975
+ ::-webkit-scrollbar { width: 6px; height: 6px; }
1976
+ ::-webkit-scrollbar-track { background: transparent; }
1977
+ ::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.4); border-radius: 3px; }
1978
+ ::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.6); }
1979
  """
1980
 
1981
  with gr.Blocks(title="LocalDuo", theme=custom_theme, css=css) as demo:
1982
+ gr.Markdown("# <span class='emoji'>πŸ‡°πŸ‡·</span><span class='emoji'>✨</span> LocalDuo - Learn Korean from PDFs, Websites & YouTube")
1983
  gr.Markdown("Enter a website URL 🌐, upload a PDF πŸ“„, upload an audio file 🎡, or paste a YouTube link 🎬. The app uses a **Vision-Language Model (VLM)** 🧠, **ASR** 🎀, and **TTS** πŸ—£οΈ to generate vocabulary flashcards.")
1984
 
1985
  active_tab = gr.State("Website URL")