fagun18 commited on
Commit
f6d3b29
·
verified ·
1 Parent(s): 6b24f86

Add ladybug loading screen

Browse files
Files changed (1) hide show
  1. src/webui/interface.py +85 -1
src/webui/interface.py CHANGED
@@ -35,6 +35,69 @@ def create_ui(theme_name="Hacker"):
35
  hacker_theme, hacker_css = get_hacker_theme()
36
 
37
  css = hacker_css + """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  .gradio-container {
39
  width: 85vw !important;
40
  max-width: 85% !important;
@@ -116,7 +179,7 @@ def create_ui(theme_name="Hacker"):
116
  }
117
  """
118
 
119
- # dark mode in default
120
  js_func = """
121
  function refresh() {
122
  const url = new URL(window.location);
@@ -125,6 +188,19 @@ def create_ui(theme_name="Hacker"):
125
  url.searchParams.set('__theme', 'dark');
126
  window.location.href = url.href;
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
  """
130
 
@@ -137,6 +213,14 @@ def create_ui(theme_name="Hacker"):
137
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
138
  """,
139
  ) as demo:
 
 
 
 
 
 
 
 
140
  with gr.Row():
141
  gr.HTML(
142
  """
 
35
  hacker_theme, hacker_css = get_hacker_theme()
36
 
37
  css = hacker_css + """
38
+ /* Custom Page Loading Screen */
39
+ #loading-screen {
40
+ position: fixed;
41
+ top: 0;
42
+ left: 0;
43
+ width: 100%;
44
+ height: 100%;
45
+ background: linear-gradient(135deg, #0a0e27 0%, #1a0e3a 100%);
46
+ display: flex;
47
+ flex-direction: column;
48
+ justify-content: center;
49
+ align-items: center;
50
+ z-index: 9999;
51
+ transition: opacity 0.5s ease-out;
52
+ }
53
+
54
+ #loading-screen.hidden {
55
+ opacity: 0;
56
+ pointer-events: none;
57
+ }
58
+
59
+ .ladybug-loader {
60
+ font-size: 100px;
61
+ animation: ladybug-bounce 1.5s ease-in-out infinite;
62
+ filter: drop-shadow(0 0 20px #ff0088);
63
+ }
64
+
65
+ @keyframes ladybug-bounce {
66
+ 0%, 100% {
67
+ transform: translateY(0) rotate(0deg);
68
+ }
69
+ 25% {
70
+ transform: translateY(-30px) rotate(-15deg);
71
+ }
72
+ 50% {
73
+ transform: translateY(0) rotate(0deg);
74
+ }
75
+ 75% {
76
+ transform: translateY(-15px) rotate(15deg);
77
+ }
78
+ }
79
+
80
+ .loading-text {
81
+ margin-top: 30px;
82
+ color: #00ff88;
83
+ font-family: 'Fira Code', monospace;
84
+ font-size: 24px;
85
+ letter-spacing: 4px;
86
+ text-shadow: 0 0 10px #00ff88;
87
+ animation: pulse-glow 2s ease-in-out infinite;
88
+ }
89
+
90
+ @keyframes pulse-glow {
91
+ 0%, 100% {
92
+ opacity: 0.6;
93
+ text-shadow: 0 0 10px #00ff88;
94
+ }
95
+ 50% {
96
+ opacity: 1;
97
+ text-shadow: 0 0 20px #00ff88, 0 0 30px #00ff88;
98
+ }
99
+ }
100
+
101
  .gradio-container {
102
  width: 85vw !important;
103
  max-width: 85% !important;
 
179
  }
180
  """
181
 
182
+ # dark mode in default + loading screen
183
  js_func = """
184
  function refresh() {
185
  const url = new URL(window.location);
 
188
  url.searchParams.set('__theme', 'dark');
189
  window.location.href = url.href;
190
  }
191
+
192
+ // Hide loading screen after page loads
193
+ window.addEventListener('load', function() {
194
+ setTimeout(function() {
195
+ const loadingScreen = document.getElementById('loading-screen');
196
+ if (loadingScreen) {
197
+ loadingScreen.classList.add('hidden');
198
+ setTimeout(function() {
199
+ loadingScreen.remove();
200
+ }, 500);
201
+ }
202
+ }, 1000);
203
+ });
204
  }
205
  """
206
 
 
213
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
214
  """,
215
  ) as demo:
216
+ # Loading Screen
217
+ gr.HTML("""
218
+ <div id="loading-screen">
219
+ <div class="ladybug-loader">🐞</div>
220
+ <div class="loading-text">INITIALIZING BUG MATRIX...</div>
221
+ </div>
222
+ """)
223
+
224
  with gr.Row():
225
  gr.HTML(
226
  """