shayekh commited on
Commit
6b25c1f
Β·
verified Β·
1 Parent(s): 7cc33b6

Beautified design

Browse files
Files changed (1) hide show
  1. app.py +148 -27
app.py CHANGED
@@ -466,40 +466,51 @@ def process_pdf(pdf_file, url_input, translit_lang, translit_format, target_lang
466
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
467
  padding: 30px;
468
  box-sizing: border-box;
469
- background: rgba(255, 255, 255, 0.8);
470
- backdrop-filter: blur(10px);
471
- border: 1px solid rgba(255,255,255,0.5);
472
  text-align: center;
 
473
  }}
474
  .card-front {{
475
- background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
 
476
  }}
477
  .card-back {{
478
  transform: rotateY(180deg);
479
- background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
480
- color: #333;
 
481
  }}
482
  .korean-text {{
483
  font-size: 54px;
484
  font-weight: 700;
485
- color: #2c3e50;
 
486
  margin-bottom: 20px;
487
  }}
488
  .english-text {{
489
- font-size: 32px;
490
- font-weight: 600;
 
 
491
  margin-bottom: 5px;
492
  }}
493
  .translit-text {{
494
- font-size: 18px;
495
  font-style: italic;
496
- color: #d35400;
497
  margin-bottom: 15px;
 
498
  }}
499
  .explanation-text {{
500
  font-size: 16px;
501
- color: #555;
502
- line-height: 1.5;
 
 
 
 
503
  }}
504
  .nav-buttons {{
505
  display: flex;
@@ -511,13 +522,25 @@ def process_pdf(pdf_file, url_input, translit_lang, translit_format, target_lang
511
  margin-right: auto;
512
  }}
513
  .nav-btn {{
514
- padding: 12px 24px;
515
  border: none;
516
- border-radius: 12px;
517
- background: #7c3aed;
 
 
518
  color: white;
519
  font-weight: 600;
520
  cursor: pointer;
 
 
 
 
 
 
 
 
 
 
521
  transition: all 0.2s;
522
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
523
  flex: 1;
@@ -538,24 +561,27 @@ def process_pdf(pdf_file, url_input, translit_lang, translit_format, target_lang
538
  box-shadow: none;
539
  }}
540
  .audio-btn {{
541
- margin-top: 20px;
542
  padding: 12px 24px;
543
- border-radius: 50px;
544
- border: none;
545
- background: #2c3e50;
546
- color: white;
547
- cursor: pointer;
548
- font-size: 16px;
549
  font-weight: 600;
550
- transition: all 0.2s;
 
551
  display: flex;
552
  align-items: center;
553
  justify-content: center;
554
  gap: 8px;
 
 
555
  }}
556
  .audio-btn:hover {{
557
- background: #34495e;
558
- transform: scale(1.05);
 
559
  }}
560
  .progress {{
561
  text-align: center;
@@ -728,7 +754,101 @@ def get_example_pdf():
728
  def create_demo():
729
  example_pdf = get_example_pdf()
730
 
 
 
 
 
 
 
 
731
  css = """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  #stream_box .progress-text,
733
  #stream_box .progress-level,
734
  #stream_box .progress,
@@ -736,7 +856,8 @@ def create_demo():
736
  display: none !important;
737
  }
738
  """
739
- with gr.Blocks(title="LocalDuo", css=css) as demo:
 
740
  gr.Markdown("# πŸ‡°πŸ‡·βœ¨ LocalDuo - Learn Korean from PDFs & Websites")
741
  gr.Markdown("Enter a website URL 🌐 or upload a Korean book PDF πŸ“„. The app uses a **Vision-Language Model (VLM)** 🧠 to extract vocabulary from text and images, and a **Text-to-Speech (TTS)** engine πŸ—£οΈ to generate pronunciation audio.")
742
 
 
466
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
467
  padding: 30px;
468
  box-sizing: border-box;
469
+ background: rgba(15, 23, 42, 0.6);
470
+ backdrop-filter: blur(15px);
471
+ border: 1px solid rgba(255, 255, 255, 0.1);
472
  text-align: center;
473
+ box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 10px 40px rgba(0, 0, 0, 0.5);
474
  }}
475
  .card-front {{
476
+ background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
477
+ border-top: 2px solid rgba(139, 92, 246, 0.5);
478
  }}
479
  .card-back {{
480
  transform: rotateY(180deg);
481
+ background: linear-gradient(135deg, rgba(30, 58, 138, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
482
+ border-top: 2px solid rgba(56, 189, 248, 0.5);
483
+ color: #f8fafc;
484
  }}
485
  .korean-text {{
486
  font-size: 54px;
487
  font-weight: 700;
488
+ color: #ffffff;
489
+ text-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
490
  margin-bottom: 20px;
491
  }}
492
  .english-text {{
493
+ font-size: 34px;
494
+ font-weight: 700;
495
+ color: #ffffff;
496
+ text-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
497
  margin-bottom: 5px;
498
  }}
499
  .translit-text {{
500
+ font-size: 20px;
501
  font-style: italic;
502
+ color: #fca5a5;
503
  margin-bottom: 15px;
504
+ letter-spacing: 1px;
505
  }}
506
  .explanation-text {{
507
  font-size: 16px;
508
+ color: #cbd5e1;
509
+ line-height: 1.6;
510
+ background: rgba(0,0,0,0.2);
511
+ padding: 15px;
512
+ border-radius: 12px;
513
+ border: 1px solid rgba(255,255,255,0.05);
514
  }}
515
  .nav-buttons {{
516
  display: flex;
 
522
  margin-right: auto;
523
  }}
524
  .nav-btn {{
525
+ padding: 14px 28px;
526
  border: none;
527
+ border-radius: 16px;
528
+ background: rgba(139, 92, 246, 0.2);
529
+ backdrop-filter: blur(5px);
530
+ border: 1px solid rgba(139, 92, 246, 0.5);
531
  color: white;
532
  font-weight: 600;
533
  cursor: pointer;
534
+ text-transform: uppercase;
535
+ letter-spacing: 1px;
536
+ transition: all 0.3s ease;
537
+ box-shadow: 0 4px 15px rgba(0,0,0,0.2);
538
+ }}
539
+ .nav-btn:hover {{
540
+ background: rgba(139, 92, 246, 0.5);
541
+ transform: translateY(-2px);
542
+ box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
543
+ }}
544
  transition: all 0.2s;
545
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
546
  flex: 1;
 
561
  box-shadow: none;
562
  }}
563
  .audio-btn {{
564
+ margin-top: 15px;
565
  padding: 12px 24px;
566
+ background: rgba(56, 189, 248, 0.2);
567
+ color: #38bdf8;
568
+ border: 1px solid rgba(56, 189, 248, 0.4);
569
+ border-radius: 20px;
570
+ font-size: 15px;
 
571
  font-weight: 600;
572
+ cursor: pointer;
573
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
574
  display: flex;
575
  align-items: center;
576
  justify-content: center;
577
  gap: 8px;
578
+ text-transform: uppercase;
579
+ letter-spacing: 1px;
580
  }}
581
  .audio-btn:hover {{
582
+ background: rgba(56, 189, 248, 0.4);
583
+ transform: scale(1.05) translateY(-2px);
584
+ box-shadow: 0 5px 15px rgba(56, 189, 248, 0.3);
585
  }}
586
  .progress {{
587
  text-align: center;
 
754
  def create_demo():
755
  example_pdf = get_example_pdf()
756
 
757
+ custom_theme = gr.themes.Soft(
758
+ primary_hue="violet",
759
+ secondary_hue="indigo",
760
+ neutral_hue="slate",
761
+ font=[gr.themes.GoogleFont("Outfit"), "ui-sans-serif", "sans-serif"]
762
+ )
763
+
764
  css = """
765
+ /* Animated Background Styling */
766
+ @keyframes gradientBG {
767
+ 0% { background-position: 0% 50%; }
768
+ 50% { background-position: 100% 50%; }
769
+ 100% { background-position: 0% 50%; }
770
+ }
771
+
772
+ body, .gradio-container {
773
+ background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #1a2a6c, #112240) !important;
774
+ background-size: 400% 400% !important;
775
+ animation: gradientBG 15s ease infinite !important;
776
+ background-attachment: fixed !important;
777
+ color: #f8fafc !important;
778
+ font-family: 'Outfit', sans-serif !important;
779
+ }
780
+
781
+ /* Advanced Glassmorphism Panels */
782
+ .gradio-container .form,
783
+ .gradio-container .panel,
784
+ .gradio-container .box {
785
+ background: rgba(15, 23, 42, 0.4) !important;
786
+ backdrop-filter: blur(20px) !important;
787
+ -webkit-backdrop-filter: blur(20px) !important;
788
+ border-radius: 24px !important;
789
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
790
+ box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
791
+ }
792
+
793
+ /* Headings */
794
+ h1 {
795
+ text-align: center;
796
+ background: linear-gradient(to right, #c084fc, #60a5fa);
797
+ -webkit-background-clip: text;
798
+ -webkit-text-fill-color: transparent;
799
+ font-weight: 800 !important;
800
+ font-size: 3em !important;
801
+ margin-bottom: 0.5em !important;
802
+ text-shadow: 0px 4px 30px rgba(192, 132, 252, 0.3);
803
+ letter-spacing: -1px;
804
+ }
805
+
806
+ /* Buttons */
807
+ button.primary {
808
+ background: linear-gradient(135deg, #8b5cf6, #3b82f6) !important;
809
+ border: none !important;
810
+ box-shadow: 0 0 20px rgba(139, 92, 246, 0.5) !important;
811
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
812
+ font-weight: 700 !important;
813
+ letter-spacing: 1px !important;
814
+ text-transform: uppercase;
815
+ border-radius: 16px !important;
816
+ color: white !important;
817
+ }
818
+ button.primary:hover {
819
+ transform: translateY(-3px) scale(1.02) !important;
820
+ box-shadow: 0 0 30px rgba(139, 92, 246, 0.8) !important;
821
+ }
822
+ button.stop {
823
+ background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
824
+ border: none !important;
825
+ box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) !important;
826
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
827
+ font-weight: 700 !important;
828
+ text-transform: uppercase;
829
+ letter-spacing: 1px !important;
830
+ border-radius: 16px !important;
831
+ color: white !important;
832
+ }
833
+ button.stop:hover {
834
+ transform: translateY(-3px) scale(1.02) !important;
835
+ box-shadow: 0 0 30px rgba(239, 68, 68, 0.8) !important;
836
+ }
837
+
838
+ /* Inputs */
839
+ textarea, input[type="text"], input[type="number"], select {
840
+ background: rgba(0, 0, 0, 0.3) !important;
841
+ border: 1px solid rgba(255,255,255,0.1) !important;
842
+ border-radius: 12px !important;
843
+ color: #f8fafc !important;
844
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
845
+ }
846
+ textarea:focus, input[type="text"]:focus {
847
+ border-color: #a855f7 !important;
848
+ box-shadow: 0 0 15px rgba(168, 85, 247, 0.4), inset 0 0 0 1px rgba(168, 85, 247, 0.4) !important;
849
+ }
850
+
851
+ /* Hide Stream Box Duplicate Progress */
852
  #stream_box .progress-text,
853
  #stream_box .progress-level,
854
  #stream_box .progress,
 
856
  display: none !important;
857
  }
858
  """
859
+
860
+ with gr.Blocks(title="LocalDuo", theme=custom_theme, css=css) as demo:
861
  gr.Markdown("# πŸ‡°πŸ‡·βœ¨ LocalDuo - Learn Korean from PDFs & Websites")
862
  gr.Markdown("Enter a website URL 🌐 or upload a Korean book PDF πŸ“„. The app uses a **Vision-Language Model (VLM)** 🧠 to extract vocabulary from text and images, and a **Text-to-Speech (TTS)** engine πŸ—£οΈ to generate pronunciation audio.")
863