MohamedFahim commited on
Commit
e9380ff
·
verified ·
1 Parent(s): ee1505b

Update interface.py

Browse files
Files changed (1) hide show
  1. interface.py +88 -43
interface.py CHANGED
@@ -96,7 +96,7 @@ def process_homepage_only(url, prompt):
96
  except Exception as e:
97
  return f"❌ Error: {str(e)}", "", ""
98
 
99
- # Custom CSS with animations and modern design
100
  custom_css = """
101
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
102
 
@@ -104,9 +104,9 @@ custom_css = """
104
  font-family: 'Inter', sans-serif !important;
105
  }
106
 
107
- /* Animated gradient background */
108
  .gradio-container {
109
- background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
110
  background-size: 400% 400%;
111
  animation: gradientShift 15s ease infinite;
112
  }
@@ -117,14 +117,14 @@ custom_css = """
117
  100% { background-position: 0% 50%; }
118
  }
119
 
120
- /* Main container with glassmorphism */
121
  .main-container {
122
  backdrop-filter: blur(20px);
123
- background: rgba(255, 255, 255, 0.85);
124
  border-radius: 24px;
125
  padding: 2rem;
126
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
127
- border: 1px solid rgba(255, 255, 255, 0.3);
128
  animation: fadeInUp 0.8s ease;
129
  }
130
 
@@ -139,9 +139,9 @@ custom_css = """
139
  }
140
  }
141
 
142
- /* Animated title */
143
  .animated-title {
144
- background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
145
  background-size: 200% 200%;
146
  -webkit-background-clip: text;
147
  -webkit-text-fill-color: transparent;
@@ -151,6 +151,7 @@ custom_css = """
151
  font-size: 3.5rem;
152
  text-align: center;
153
  margin-bottom: 0.5rem;
 
154
  }
155
 
156
  @keyframes gradientText {
@@ -170,59 +171,63 @@ custom_css = """
170
  50% { transform: translateY(-10px); }
171
  }
172
 
173
- /* Input fields with modern styling */
174
  textarea, input[type="text"] {
175
  font-size: 1.1rem !important;
176
  border-radius: 12px !important;
177
- border: 2px solid rgba(102, 126, 234, 0.3) !important;
178
  transition: all 0.3s ease !important;
179
- background: rgba(255, 255, 255, 0.9) !important;
 
180
  }
181
 
182
  textarea:focus, input[type="text"]:focus {
183
- border-color: #667eea !important;
184
- box-shadow: 0 0 20px rgba(102, 126, 234, 0.3) !important;
185
  transform: translateY(-2px);
 
186
  }
187
 
188
- /* Labels with animation */
189
  label {
190
  font-weight: 600 !important;
191
- color: #333 !important;
192
  font-size: 1.1rem !important;
193
  transition: all 0.3s ease;
194
  }
195
 
196
- /* Buttons with hover effects */
197
  .gr-button {
198
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
199
- color: white !important;
200
  border: none !important;
201
  border-radius: 12px !important;
202
  padding: 0.75rem 2rem !important;
203
  font-size: 1.1rem !important;
204
  font-weight: 600 !important;
205
  transition: all 0.3s ease !important;
206
- box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
207
  }
208
 
209
  .gr-button:hover {
210
  transform: translateY(-3px) !important;
211
- box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6) !important;
 
212
  }
213
 
214
  .gr-button:active {
215
  transform: translateY(-1px) !important;
216
  }
217
 
218
- /* Output boxes with glassmorphism */
219
  .output-box {
220
- background: rgba(255, 255, 255, 0.95) !important;
221
  border-radius: 16px !important;
222
- border: 1px solid rgba(102, 126, 234, 0.2) !important;
223
  backdrop-filter: blur(10px);
224
  animation: slideIn 0.5s ease;
225
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
 
226
  }
227
 
228
  @keyframes slideIn {
@@ -236,18 +241,27 @@ label {
236
  }
237
  }
238
 
239
- /* Tab styling */
240
  .tab-nav button {
241
  border-radius: 12px !important;
242
  font-weight: 600 !important;
243
  transition: all 0.3s ease !important;
244
  font-size: 1.05rem !important;
 
 
 
 
 
 
 
 
245
  }
246
 
247
  .tab-nav button[aria-selected="true"] {
248
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
249
- color: white !important;
250
- box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
 
251
  }
252
 
253
  /* Info cards with pulse animation */
@@ -260,12 +274,12 @@ label {
260
  50% { transform: scale(1.02); }
261
  }
262
 
263
- /* Example box styling */
264
  .example-box {
265
- background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
266
  border-radius: 16px;
267
  padding: 1.5rem;
268
- border-left: 4px solid #667eea;
269
  margin-top: 2rem;
270
  transition: all 0.3s ease;
271
  animation: fadeIn 1s ease;
@@ -273,7 +287,11 @@ label {
273
 
274
  .example-box:hover {
275
  transform: translateX(5px);
276
- box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
 
 
 
 
277
  }
278
 
279
  @keyframes fadeIn {
@@ -281,12 +299,12 @@ label {
281
  to { opacity: 1; }
282
  }
283
 
284
- /* Note box with shimmer effect */
285
  .note-box {
286
- background: linear-gradient(135deg, rgba(33, 150, 243, 0.1) 0%, rgba(3, 169, 244, 0.1) 100%);
287
  border-radius: 12px;
288
  padding: 1rem;
289
- border-left: 4px solid #2196f3;
290
  margin-top: 1rem;
291
  position: relative;
292
  overflow: hidden;
@@ -299,18 +317,24 @@ label {
299
  left: -100%;
300
  width: 100%;
301
  height: 100%;
302
- background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
303
  animation: shimmer 3s infinite;
304
  }
305
 
 
 
 
 
 
 
306
  @keyframes shimmer {
307
  0% { left: -100%; }
308
  100% { left: 100%; }
309
  }
310
 
311
- /* Subtitle animation */
312
  .subtitle {
313
- color: #666;
314
  font-size: 1.3rem;
315
  text-align: center;
316
  margin-bottom: 2rem;
@@ -333,15 +357,36 @@ label {
333
  display: inline-block;
334
  width: 20px;
335
  height: 20px;
336
- border: 3px solid rgba(102, 126, 234, 0.3);
337
  border-radius: 50%;
338
- border-top-color: #667eea;
339
  animation: spin 1s ease-in-out infinite;
340
  }
341
 
342
  @keyframes spin {
343
  to { transform: rotate(360deg); }
344
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  """
346
 
347
  # Main interface with tabs
@@ -416,7 +461,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as interface:
416
 
417
  gr.HTML("""
418
  <div class="example-box">
419
- <h3 style="margin-top: 0; color: #333; font-size: 1.4rem;">
420
  <span class="floating-icon">💡</span> Example Usage
421
  </h3>
422
  <p style="font-size: 1.1rem;"><strong>URL:</strong> https://openai.com</p>
@@ -424,7 +469,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as interface:
424
  </div>
425
 
426
  <div class="note-box">
427
- <p style="margin: 0; color: #0d47a1; font-size: 1.05rem;">
428
  ℹ️ <strong>Note:</strong> If you encounter connection errors, please wait a moment for the system to initialize and try again.
429
  </p>
430
  </div>
 
96
  except Exception as e:
97
  return f"❌ Error: {str(e)}", "", ""
98
 
99
+ # Dark theme custom CSS with animations
100
  custom_css = """
101
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
102
 
 
104
  font-family: 'Inter', sans-serif !important;
105
  }
106
 
107
+ /* Dark animated gradient background */
108
  .gradio-container {
109
+ background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #1a1a2e);
110
  background-size: 400% 400%;
111
  animation: gradientShift 15s ease infinite;
112
  }
 
117
  100% { background-position: 0% 50%; }
118
  }
119
 
120
+ /* Main container with dark glassmorphism */
121
  .main-container {
122
  backdrop-filter: blur(20px);
123
+ background: rgba(20, 20, 30, 0.85);
124
  border-radius: 24px;
125
  padding: 2rem;
126
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
127
+ border: 1px solid rgba(255, 255, 255, 0.1);
128
  animation: fadeInUp 0.8s ease;
129
  }
130
 
 
139
  }
140
  }
141
 
142
+ /* Animated title with neon glow */
143
  .animated-title {
144
+ background: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #00c6ff 100%);
145
  background-size: 200% 200%;
146
  -webkit-background-clip: text;
147
  -webkit-text-fill-color: transparent;
 
151
  font-size: 3.5rem;
152
  text-align: center;
153
  margin-bottom: 0.5rem;
154
+ filter: drop-shadow(0 0 20px rgba(0, 242, 254, 0.5));
155
  }
156
 
157
  @keyframes gradientText {
 
171
  50% { transform: translateY(-10px); }
172
  }
173
 
174
+ /* Dark input fields with neon borders */
175
  textarea, input[type="text"] {
176
  font-size: 1.1rem !important;
177
  border-radius: 12px !important;
178
+ border: 2px solid rgba(0, 242, 254, 0.3) !important;
179
  transition: all 0.3s ease !important;
180
+ background: rgba(30, 30, 45, 0.9) !important;
181
+ color: #e0e0e0 !important;
182
  }
183
 
184
  textarea:focus, input[type="text"]:focus {
185
+ border-color: #00f2fe !important;
186
+ box-shadow: 0 0 20px rgba(0, 242, 254, 0.4) !important;
187
  transform: translateY(-2px);
188
+ background: rgba(35, 35, 50, 0.95) !important;
189
  }
190
 
191
+ /* Dark labels */
192
  label {
193
  font-weight: 600 !important;
194
+ color: #b0b0b0 !important;
195
  font-size: 1.1rem !important;
196
  transition: all 0.3s ease;
197
  }
198
 
199
+ /* Neon buttons with hover effects */
200
  .gr-button {
201
+ background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%) !important;
202
+ color: #0a0a0f !important;
203
  border: none !important;
204
  border-radius: 12px !important;
205
  padding: 0.75rem 2rem !important;
206
  font-size: 1.1rem !important;
207
  font-weight: 600 !important;
208
  transition: all 0.3s ease !important;
209
+ box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4) !important;
210
  }
211
 
212
  .gr-button:hover {
213
  transform: translateY(-3px) !important;
214
+ box-shadow: 0 6px 25px rgba(0, 242, 254, 0.6) !important;
215
+ filter: brightness(1.1);
216
  }
217
 
218
  .gr-button:active {
219
  transform: translateY(-1px) !important;
220
  }
221
 
222
+ /* Dark output boxes with glassmorphism */
223
  .output-box {
224
+ background: rgba(30, 30, 45, 0.95) !important;
225
  border-radius: 16px !important;
226
+ border: 1px solid rgba(0, 242, 254, 0.2) !important;
227
  backdrop-filter: blur(10px);
228
  animation: slideIn 0.5s ease;
229
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
230
+ color: #e0e0e0 !important;
231
  }
232
 
233
  @keyframes slideIn {
 
241
  }
242
  }
243
 
244
+ /* Dark tab styling */
245
  .tab-nav button {
246
  border-radius: 12px !important;
247
  font-weight: 600 !important;
248
  transition: all 0.3s ease !important;
249
  font-size: 1.05rem !important;
250
+ background: rgba(30, 30, 45, 0.6) !important;
251
+ color: #b0b0b0 !important;
252
+ border: 1px solid rgba(0, 242, 254, 0.2) !important;
253
+ }
254
+
255
+ .tab-nav button:hover {
256
+ background: rgba(40, 40, 55, 0.8) !important;
257
+ border-color: rgba(0, 242, 254, 0.4) !important;
258
  }
259
 
260
  .tab-nav button[aria-selected="true"] {
261
+ background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%) !important;
262
+ color: #0a0a0f !important;
263
+ box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4) !important;
264
+ border: none !important;
265
  }
266
 
267
  /* Info cards with pulse animation */
 
274
  50% { transform: scale(1.02); }
275
  }
276
 
277
+ /* Dark example box styling */
278
  .example-box {
279
+ background: linear-gradient(135deg, rgba(0, 242, 254, 0.1) 0%, rgba(79, 172, 254, 0.1) 100%);
280
  border-radius: 16px;
281
  padding: 1.5rem;
282
+ border-left: 4px solid #00f2fe;
283
  margin-top: 2rem;
284
  transition: all 0.3s ease;
285
  animation: fadeIn 1s ease;
 
287
 
288
  .example-box:hover {
289
  transform: translateX(5px);
290
+ box-shadow: 0 5px 20px rgba(0, 242, 254, 0.2);
291
+ }
292
+
293
+ .example-box h3, .example-box p {
294
+ color: #e0e0e0 !important;
295
  }
296
 
297
  @keyframes fadeIn {
 
299
  to { opacity: 1; }
300
  }
301
 
302
+ /* Dark note box with shimmer effect */
303
  .note-box {
304
+ background: linear-gradient(135deg, rgba(0, 242, 254, 0.08) 0%, rgba(79, 172, 254, 0.08) 100%);
305
  border-radius: 12px;
306
  padding: 1rem;
307
+ border-left: 4px solid #00f2fe;
308
  margin-top: 1rem;
309
  position: relative;
310
  overflow: hidden;
 
317
  left: -100%;
318
  width: 100%;
319
  height: 100%;
320
+ background: linear-gradient(90deg, transparent, rgba(0, 242, 254, 0.2), transparent);
321
  animation: shimmer 3s infinite;
322
  }
323
 
324
+ .note-box p {
325
+ color: #00c6ff !important;
326
+ position: relative;
327
+ z-index: 1;
328
+ }
329
+
330
  @keyframes shimmer {
331
  0% { left: -100%; }
332
  100% { left: 100%; }
333
  }
334
 
335
+ /* Dark subtitle animation */
336
  .subtitle {
337
+ color: #b0b0b0;
338
  font-size: 1.3rem;
339
  text-align: center;
340
  margin-bottom: 2rem;
 
357
  display: inline-block;
358
  width: 20px;
359
  height: 20px;
360
+ border: 3px solid rgba(0, 242, 254, 0.3);
361
  border-radius: 50%;
362
+ border-top-color: #00f2fe;
363
  animation: spin 1s ease-in-out infinite;
364
  }
365
 
366
  @keyframes spin {
367
  to { transform: rotate(360deg); }
368
  }
369
+
370
+ /* Neon glow effect on containers */
371
+ .main-container::before {
372
+ content: '';
373
+ position: absolute;
374
+ top: -2px;
375
+ left: -2px;
376
+ right: -2px;
377
+ bottom: -2px;
378
+ background: linear-gradient(45deg, #00f2fe, #4facfe, #00f2fe);
379
+ border-radius: 24px;
380
+ z-index: -1;
381
+ opacity: 0.3;
382
+ filter: blur(10px);
383
+ animation: neonPulse 3s ease-in-out infinite;
384
+ }
385
+
386
+ @keyframes neonPulse {
387
+ 0%, 100% { opacity: 0.3; }
388
+ 50% { opacity: 0.5; }
389
+ }
390
  """
391
 
392
  # Main interface with tabs
 
461
 
462
  gr.HTML("""
463
  <div class="example-box">
464
+ <h3 style="margin-top: 0; font-size: 1.4rem;">
465
  <span class="floating-icon">💡</span> Example Usage
466
  </h3>
467
  <p style="font-size: 1.1rem;"><strong>URL:</strong> https://openai.com</p>
 
469
  </div>
470
 
471
  <div class="note-box">
472
+ <p style="margin: 0; font-size: 1.05rem;">
473
  ℹ️ <strong>Note:</strong> If you encounter connection errors, please wait a moment for the system to initialize and try again.
474
  </p>
475
  </div>