rdune71 commited on
Commit
d4c3c03
·
1 Parent(s): 3d8ff3e
Files changed (1) hide show
  1. app.py +79 -118
app.py CHANGED
@@ -238,7 +238,7 @@ orchestrator = initialize_modules()
238
 
239
  # Custom CSS for enhanced UI with improved visibility and contrast
240
  custom_css = """
241
- /* Reset and base styles */
242
  * {
243
  margin: 0;
244
  padding: 0;
@@ -248,27 +248,27 @@ custom_css = """
248
  html, body {
249
  height: 100%;
250
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
251
- background-color: #1e1e2e !important;
252
- color: #e0e0e0 !important;
253
  line-height: 1.6;
254
  }
255
 
256
- /* Main container */
257
  .container {
258
  max-width: 1200px;
259
  margin: 0 auto;
260
  padding: 20px;
261
  }
262
 
263
- /* Header styles */
264
  .header {
265
  text-align: center;
266
  margin-bottom: 30px;
267
  padding: 25px;
268
- background: linear-gradient(135deg, #2563eb, #1d4ed8);
269
- color: white;
270
  border-radius: 12px;
271
- box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
 
272
  }
273
 
274
  .title {
@@ -279,60 +279,49 @@ html, body {
279
 
280
  .subtitle {
281
  font-size: 1.2rem;
282
- opacity: 0.95;
283
  margin-bottom: 15px;
284
  }
285
 
286
  .version-info {
287
  font-size: 1rem;
288
- background: rgba(255, 255, 255, 0.15);
289
- padding: 8px 15px;
290
  border-radius: 20px;
291
  display: inline-block;
292
  backdrop-filter: blur(5px);
293
  }
294
 
295
- /* Card styles */
296
  .card {
297
- background: #2d2d44 !important;
298
  border-radius: 12px;
299
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
300
  padding: 25px;
301
  margin-bottom: 25px;
 
302
  transition: all 0.3s ease;
303
- border: 1px solid #3b82f6;
304
- color: #e0e0e0 !important;
305
  }
306
 
307
  .card:hover {
308
  transform: translateY(-3px);
309
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
310
- }
311
-
312
- .input-section {
313
- background: linear-gradient(to bottom right, #1e293b, #334155);
314
- border: 1px solid #3b82f6;
315
  }
316
 
317
- .output-section {
318
- background: #1e293b !important;
319
- border: 1px solid #3b82f6;
320
- }
321
-
322
- /* Section headings */
323
  .card h3 {
324
- color: #60a5fa !important;
325
  margin-bottom: 20px;
326
- font-size: 1.4rem;
327
  font-weight: 600;
328
- border-bottom: 2px solid #3b82f6;
329
  padding-bottom: 10px;
330
  }
331
 
332
- /* Button styles */
333
  .btn-primary {
334
- background: linear-gradient(135deg, #2563eb, #1d4ed8);
335
- color: white !important;
336
  border: none;
337
  padding: 14px 28px;
338
  font-size: 17px;
@@ -340,7 +329,7 @@ html, body {
340
  cursor: pointer;
341
  transition: all 0.3s ease;
342
  font-weight: 600;
343
- box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
344
  display: inline-block;
345
  width: 100%;
346
  text-align: center;
@@ -348,51 +337,46 @@ html, body {
348
 
349
  .btn-primary:hover {
350
  transform: translateY(-3px);
351
- box-shadow: 0 6px 15px rgba(37, 99, 235, 0.6);
352
- background: linear-gradient(135deg, #1d4ed8, #1e40af);
353
  }
354
 
355
  .btn-primary:active {
356
  transform: translateY(1px);
357
- box-shadow: 0 2px 5px rgba(37, 99, 235, 0.4);
358
  }
359
 
360
- /* Input fields */
361
  .gr-textbox, .gr-textbox input, .gr-textbox textarea {
362
- color: #e0e0e0 !important;
363
- background-color: #334155 !important;
364
- border: 2px solid #3b82f6 !important;
365
  border-radius: 8px !important;
366
  padding: 12px 15px !important;
367
  font-size: 16px !important;
368
- transition: border-color 0.3s ease;
369
  width: 100%;
370
  }
371
 
372
  .gr-textbox:focus, .gr-textbox input:focus, .gr-textbox textarea:focus {
373
- border-color: #06b6d4 !important;
374
- box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.3) !important;
375
  }
376
 
377
- /* File upload */
378
  .gr-file {
379
- border: 2px dashed #3b82f6 !important;
380
  border-radius: 8px !important;
381
  padding: 15px !important;
382
- background-color: #334155 !important;
383
  color: #e0e0e0 !important;
384
  }
385
 
386
  .gr-file:hover {
387
- border-color: #06b6d4 !important;
388
- background-color: #1e293b !important;
389
  }
390
 
391
  /* Checkbox */
392
- .gr-checkbox {
393
- margin: 15px 0;
394
- }
395
-
396
  .gr-checkbox label {
397
  font-size: 16px;
398
  color: #e0e0e0 !important;
@@ -400,39 +384,39 @@ html, body {
400
  align-items: center;
401
  }
402
 
403
- /* Streaming content area */
404
  .streaming-content {
405
  white-space: pre-wrap;
406
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
407
- background-color: #1e293b !important;
408
  padding: 20px;
409
  border-radius: 10px;
410
  margin: 15px 0;
411
- border-left: 5px solid #3b82f6;
412
- box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.4);
413
  min-height: 150px;
414
  max-height: 700px;
415
  overflow-y: auto;
416
  color: #e0e0e0 !important;
417
  font-size: 16px;
418
  line-height: 1.7;
419
- border: 1px solid #374151;
420
  }
421
 
422
  .streaming-content h2 {
423
- color: #60a5fa !important;
424
- border-bottom: 2px solid #3b82f6;
425
  padding-bottom: 10px;
426
  margin-top: 0;
427
  }
428
 
429
  .streaming-content h3 {
430
- color: #06b6d4 !important;
431
  margin-top: 20px;
432
  }
433
 
434
  .streaming-content ul, .streaming-content ol {
435
- padding-left: 30px;
436
  margin: 15px 0;
437
  }
438
 
@@ -440,23 +424,23 @@ html, body {
440
  margin-bottom: 8px;
441
  }
442
 
443
- /* Status indicator */
444
  .status-indicator {
445
  display: flex;
446
  align-items: center;
447
  justify-content: center;
448
  padding: 12px;
449
- background: #334155;
450
  border-radius: 8px;
451
  margin: 15px 0;
452
- color: #60a5fa;
453
  font-weight: 500;
454
- border: 1px solid #3b82f6;
455
  }
456
 
457
  .spinner {
458
- border: 4px solid #1e293b;
459
- border-top: 4px solid #3b82f6;
460
  border-radius: 50%;
461
  width: 24px;
462
  height: 24px;
@@ -468,7 +452,6 @@ html, body {
468
  .progress-text {
469
  margin-left: 10px;
470
  font-weight: 500;
471
- color: #e0e0e0 !important;
472
  }
473
 
474
  /* Footer */
@@ -476,36 +459,34 @@ html, body {
476
  text-align: center;
477
  margin-top: 30px;
478
  padding: 25px;
479
- color: #9ca3af !important;
480
  font-size: 0.95rem;
481
- background: #1e293b;
482
  border-radius: 10px;
483
- border-top: 1px solid #3b82f6;
484
  }
485
 
486
  .footer p {
487
  margin: 8px 0;
488
- color: #e0e0e0 !important;
489
  }
490
 
491
  .highlight {
492
- background: linear-gradient(120deg, #2563eb, #1d4ed8);
493
  padding: 3px 8px;
494
  border-radius: 5px;
495
  font-weight: 600;
496
- color: #ffffff;
497
  }
498
 
499
- /* Markdown content */
500
  .gr-markdown {
501
  color: #e0e0e0 !important;
502
  line-height: 1.7;
503
- background-color: #1e293b !important;
504
  }
505
 
506
- .gr-markdown h1, .gr-markdown h2, .gr-markdown h3,
507
- .gr-markdown h4, .gr-markdown h5, .gr-markdown h6 {
508
- color: #60a5fa !important;
509
  margin-top: 1.5rem;
510
  margin-bottom: 1rem;
511
  }
@@ -516,29 +497,29 @@ html, body {
516
  }
517
 
518
  .gr-markdown a {
519
- color: #06b6d4 !important;
520
  text-decoration: underline;
521
  }
522
 
523
  .gr-markdown a:hover {
524
- color: #0891b2 !important;
525
  }
526
 
527
  .gr-markdown code {
528
- background-color: #334155 !important;
529
  padding: 2px 6px !important;
530
  border-radius: 4px !important;
531
- color: #f59e0b !important;
532
  font-size: 0.95em !important;
533
  }
534
 
535
  .gr-markdown pre {
536
- background-color: #334155 !important;
537
  padding: 15px !important;
538
  border-radius: 8px !important;
539
  overflow-x: auto !important;
540
  color: #e0e0e0 !important;
541
- border: 1px solid #3b82f6 !important;
542
  }
543
 
544
  .gr-markdown pre code {
@@ -548,9 +529,9 @@ html, body {
548
  }
549
 
550
  .gr-markdown blockquote {
551
- border-left: 4px solid #3b82f6 !important;
552
  padding: 10px 20px !important;
553
- background-color: #1e293b !important;
554
  margin: 20px 0 !important;
555
  border-radius: 0 8px 8px 0 !important;
556
  color: #e0e0e0 !important;
@@ -563,67 +544,47 @@ html, body {
563
  }
564
 
565
  .gr-markdown table th, .gr-markdown table td {
566
- border: 1px solid #3b82f6 !important;
567
  padding: 10px !important;
568
  text-align: left !important;
569
  color: #e0e0e0 !important;
570
  }
571
 
572
  .gr-markdown table th {
573
- background-color: #1d4ed8 !important;
574
  color: #ffffff !important;
575
  }
576
 
577
- /* Animations */
578
  @keyframes spin {
579
  0% { transform: rotate(0deg); }
580
  100% { transform: rotate(360deg); }
581
  }
582
 
583
- /* Responsive design */
584
  @media (max-width: 768px) {
585
- .container {
586
- padding: 15px;
587
- }
588
-
589
- .header {
590
- padding: 20px 15px;
591
- }
592
-
593
  .title {
594
  font-size: 2rem;
595
  }
596
-
597
  .subtitle {
598
  font-size: 1.1rem;
599
  }
600
-
601
  .card {
602
  padding: 20px 15px;
603
  }
604
-
605
  .btn-primary {
606
  padding: 12px 20px;
607
  font-size: 16px;
608
  }
609
-
610
  .streaming-content {
611
  padding: 15px;
612
  font-size: 15px;
613
  }
614
  }
615
-
616
- /* High contrast mode support */
617
- @media (prefers-contrast: high) {
618
- body {
619
- background-color: #000000 !important;
620
- color: #ffffff !important;
621
- }
622
-
623
- .card {
624
- border: 2px solid #ffffff;
625
- }
626
- }
627
  """
628
 
629
  def research_assistant(query, file, use_ddg, progress=gr.Progress()):
@@ -692,4 +653,4 @@ with gr.Blocks(css=custom_css, title="Research Assistant") as demo:
692
  """)
693
 
694
  if __name__ == "__main__":
695
- demo.launch(share=True)
 
238
 
239
  # Custom CSS for enhanced UI with improved visibility and contrast
240
  custom_css = """
241
+ /* Base Reset */
242
  * {
243
  margin: 0;
244
  padding: 0;
 
248
  html, body {
249
  height: 100%;
250
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
251
+ background: #0f0f0f;
252
+ color: #e0e0e0;
253
  line-height: 1.6;
254
  }
255
 
256
+ /* Container */
257
  .container {
258
  max-width: 1200px;
259
  margin: 0 auto;
260
  padding: 20px;
261
  }
262
 
263
+ /* Header */
264
  .header {
265
  text-align: center;
266
  margin-bottom: 30px;
267
  padding: 25px;
268
+ background: linear-gradient(135deg, #1a1a1a, #262626);
 
269
  border-radius: 12px;
270
+ box-shadow: 0 4px 20px rgba(0,0,0,0.3);
271
+ color: #ffffff;
272
  }
273
 
274
  .title {
 
279
 
280
  .subtitle {
281
  font-size: 1.2rem;
282
+ opacity: 0.85;
283
  margin-bottom: 15px;
284
  }
285
 
286
  .version-info {
287
  font-size: 1rem;
288
+ background: rgba(255,255,255,0.05);
289
+ padding: 6px 12px;
290
  border-radius: 20px;
291
  display: inline-block;
292
  backdrop-filter: blur(5px);
293
  }
294
 
295
+ /* Card Style */
296
  .card {
297
+ background: #1a1a1a;
298
  border-radius: 12px;
299
+ box-shadow: 0 4px 20px rgba(0,0,0,0.3);
300
  padding: 25px;
301
  margin-bottom: 25px;
302
+ border: 1px solid rgba(255,255,255,0.05);
303
  transition: all 0.3s ease;
 
 
304
  }
305
 
306
  .card:hover {
307
  transform: translateY(-3px);
308
+ box-shadow: 0 8px 25px rgba(0,0,0,0.4);
 
 
 
 
 
309
  }
310
 
311
+ /* Section Headers */
 
 
 
 
 
312
  .card h3 {
313
+ color: #00ffff;
314
  margin-bottom: 20px;
315
+ font-size: 1.3rem;
316
  font-weight: 600;
317
+ border-bottom: 1px solid rgba(255,255,255,0.1);
318
  padding-bottom: 10px;
319
  }
320
 
321
+ /* Button */
322
  .btn-primary {
323
+ background: linear-gradient(135deg, #00ffff, #0099cc);
324
+ color: #000000;
325
  border: none;
326
  padding: 14px 28px;
327
  font-size: 17px;
 
329
  cursor: pointer;
330
  transition: all 0.3s ease;
331
  font-weight: 600;
332
+ box-shadow: 0 4px 10px rgba(0,255,255,0.3);
333
  display: inline-block;
334
  width: 100%;
335
  text-align: center;
 
337
 
338
  .btn-primary:hover {
339
  transform: translateY(-3px);
340
+ box-shadow: 0 6px 15px rgba(0,255,255,0.5);
341
+ background: linear-gradient(135deg, #00cccc, #0099cc);
342
  }
343
 
344
  .btn-primary:active {
345
  transform: translateY(1px);
346
+ box-shadow: 0 2px 8px rgba(0,255,255,0.3);
347
  }
348
 
349
+ /* Inputs */
350
  .gr-textbox, .gr-textbox input, .gr-textbox textarea {
351
+ color: #ffffff !important;
352
+ background-color: #262626 !important;
353
+ border: 2px solid #333333 !important;
354
  border-radius: 8px !important;
355
  padding: 12px 15px !important;
356
  font-size: 16px !important;
 
357
  width: 100%;
358
  }
359
 
360
  .gr-textbox:focus, .gr-textbox input:focus, .gr-textbox textarea:focus {
361
+ border-color: #00ffff !important;
362
+ box-shadow: 0 0 0 3px rgba(0,255,255,0.3) !important;
363
  }
364
 
365
+ /* File Upload */
366
  .gr-file {
367
+ border: 2px dashed #333333 !important;
368
  border-radius: 8px !important;
369
  padding: 15px !important;
370
+ background-color: #262626 !important;
371
  color: #e0e0e0 !important;
372
  }
373
 
374
  .gr-file:hover {
375
+ border-color: #00ffff !important;
376
+ background-color: #1f1f1f !important;
377
  }
378
 
379
  /* Checkbox */
 
 
 
 
380
  .gr-checkbox label {
381
  font-size: 16px;
382
  color: #e0e0e0 !important;
 
384
  align-items: center;
385
  }
386
 
387
+ /* Streaming Output */
388
  .streaming-content {
389
  white-space: pre-wrap;
390
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
391
+ background-color: #1f1f1f !important;
392
  padding: 20px;
393
  border-radius: 10px;
394
  margin: 15px 0;
395
+ border-left: 4px solid #00ffff;
396
+ box-shadow: inset 0 0 8px rgba(0,0,0,0.3);
397
  min-height: 150px;
398
  max-height: 700px;
399
  overflow-y: auto;
400
  color: #e0e0e0 !important;
401
  font-size: 16px;
402
  line-height: 1.7;
403
+ border: 1px solid #333333;
404
  }
405
 
406
  .streaming-content h2 {
407
+ color: #00ffff !important;
408
+ border-bottom: 1px solid #333333;
409
  padding-bottom: 10px;
410
  margin-top: 0;
411
  }
412
 
413
  .streaming-content h3 {
414
+ color: #00cccc !important;
415
  margin-top: 20px;
416
  }
417
 
418
  .streaming-content ul, .streaming-content ol {
419
+ padding-left: 25px;
420
  margin: 15px 0;
421
  }
422
 
 
424
  margin-bottom: 8px;
425
  }
426
 
427
+ /* Status Indicator */
428
  .status-indicator {
429
  display: flex;
430
  align-items: center;
431
  justify-content: center;
432
  padding: 12px;
433
+ background: #262626;
434
  border-radius: 8px;
435
  margin: 15px 0;
436
+ color: #00ffff;
437
  font-weight: 500;
438
+ border: 1px solid #333333;
439
  }
440
 
441
  .spinner {
442
+ border: 4px solid #111111;
443
+ border-top: 4px solid #00ffff;
444
  border-radius: 50%;
445
  width: 24px;
446
  height: 24px;
 
452
  .progress-text {
453
  margin-left: 10px;
454
  font-weight: 500;
 
455
  }
456
 
457
  /* Footer */
 
459
  text-align: center;
460
  margin-top: 30px;
461
  padding: 25px;
462
+ color: #888888;
463
  font-size: 0.95rem;
464
+ background: #111111;
465
  border-radius: 10px;
466
+ border-top: 1px solid #222222;
467
  }
468
 
469
  .footer p {
470
  margin: 8px 0;
 
471
  }
472
 
473
  .highlight {
474
+ background: linear-gradient(120deg, #00ffff, #0099cc);
475
  padding: 3px 8px;
476
  border-radius: 5px;
477
  font-weight: 600;
478
+ color: #000000;
479
  }
480
 
481
+ /* Markdown Styling */
482
  .gr-markdown {
483
  color: #e0e0e0 !important;
484
  line-height: 1.7;
485
+ background-color: #1f1f1f !important;
486
  }
487
 
488
+ .gr-markdown h1, .gr-markdown h2, .gr-markdown h3, .gr-markdown h4, .gr-markdown h5, .gr-markdown h6 {
489
+ color: #00ffff !important;
 
490
  margin-top: 1.5rem;
491
  margin-bottom: 1rem;
492
  }
 
497
  }
498
 
499
  .gr-markdown a {
500
+ color: #00cccc !important;
501
  text-decoration: underline;
502
  }
503
 
504
  .gr-markdown a:hover {
505
+ color: #00eeee !important;
506
  }
507
 
508
  .gr-markdown code {
509
+ background-color: #262626 !important;
510
  padding: 2px 6px !important;
511
  border-radius: 4px !important;
512
+ color: #ffcc00 !important;
513
  font-size: 0.95em !important;
514
  }
515
 
516
  .gr-markdown pre {
517
+ background-color: #262626 !important;
518
  padding: 15px !important;
519
  border-radius: 8px !important;
520
  overflow-x: auto !important;
521
  color: #e0e0e0 !important;
522
+ border: 1px solid #333333 !important;
523
  }
524
 
525
  .gr-markdown pre code {
 
529
  }
530
 
531
  .gr-markdown blockquote {
532
+ border-left: 4px solid #00ffff !important;
533
  padding: 10px 20px !important;
534
+ background-color: #1a1a1a !important;
535
  margin: 20px 0 !important;
536
  border-radius: 0 8px 8px 0 !important;
537
  color: #e0e0e0 !important;
 
544
  }
545
 
546
  .gr-markdown table th, .gr-markdown table td {
547
+ border: 1px solid #333333 !important;
548
  padding: 10px !important;
549
  text-align: left !important;
550
  color: #e0e0e0 !important;
551
  }
552
 
553
  .gr-markdown table th {
554
+ background-color: #222222 !important;
555
  color: #ffffff !important;
556
  }
557
 
558
+ /* Spinner Animation */
559
  @keyframes spin {
560
  0% { transform: rotate(0deg); }
561
  100% { transform: rotate(360deg); }
562
  }
563
 
564
+ /* Responsive Design */
565
  @media (max-width: 768px) {
 
 
 
 
 
 
 
 
566
  .title {
567
  font-size: 2rem;
568
  }
569
+
570
  .subtitle {
571
  font-size: 1.1rem;
572
  }
573
+
574
  .card {
575
  padding: 20px 15px;
576
  }
577
+
578
  .btn-primary {
579
  padding: 12px 20px;
580
  font-size: 16px;
581
  }
582
+
583
  .streaming-content {
584
  padding: 15px;
585
  font-size: 15px;
586
  }
587
  }
 
 
 
 
 
 
 
 
 
 
 
 
588
  """
589
 
590
  def research_assistant(query, file, use_ddg, progress=gr.Progress()):
 
653
  """)
654
 
655
  if __name__ == "__main__":
656
+ demo.launch(share=True)