harrytarlton commited on
Commit
b18b623
·
1 Parent(s): 729a981

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +80 -45
app.py CHANGED
@@ -383,10 +383,10 @@ body {
383
  overflow: hidden !important;
384
  }
385
 
386
- /* Clean modern design */
387
  .gradio-container {
388
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
389
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
390
  color: #fff;
391
  height: 100vh;
392
  max-height: 100vh;
@@ -455,7 +455,7 @@ body {
455
  .file-panel-header {
456
  background: rgba(255, 255, 255, 0.15);
457
  padding: 15px;
458
- border-bottom: 2px solid #fbbf24;
459
  display: flex;
460
  align-items: center;
461
  gap: 10px;
@@ -484,13 +484,13 @@ body {
484
  }
485
 
486
  .file-item:hover {
487
- background: rgba(251, 191, 36, 0.3);
488
  transform: translateX(5px);
489
  }
490
 
491
  .file-item.selected {
492
- background: rgba(251, 191, 36, 0.4);
493
- border-left: 4px solid #fbbf24;
494
  }
495
 
496
  /* Main content area */
@@ -513,11 +513,11 @@ body {
513
  border: 1px solid rgba(255, 255, 255, 0.2);
514
  }
515
 
516
- /* Button styling */
517
  .gr-button {
518
- background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
519
  border: none !important;
520
- color: #1f2937 !important;
521
  padding: 10px 20px !important;
522
  border-radius: 6px !important;
523
  font-weight: 600 !important;
@@ -525,14 +525,14 @@ body {
525
  }
526
 
527
  .gr-button:hover {
528
- background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
529
  transform: translateY(-2px) !important;
530
- box-shadow: 0 5px 15px rgba(251, 191, 36, 0.4) !important;
531
  }
532
 
533
  /* Slider styling */
534
  .gr-slider input {
535
- accent-color: #fbbf24 !important;
536
  }
537
 
538
  /* Center slider values */
@@ -549,7 +549,7 @@ body {
549
  position: relative;
550
  background: rgba(255, 255, 255, 0.1);
551
  backdrop-filter: blur(10px);
552
- border: 1px solid rgba(251, 191, 36, 0.5);
553
  border-radius: 6px;
554
  padding: 0;
555
  margin-top: 20px;
@@ -562,7 +562,7 @@ body {
562
  top: 0;
563
  left: 0;
564
  height: 100%;
565
- background: linear-gradient(90deg, #fbbf24, #f59e0b);
566
  width: 0%;
567
  transition: width 0.3s ease;
568
  }
@@ -590,10 +590,38 @@ body {
590
  /* Dropdown styling */
591
  .gr-dropdown {
592
  background: rgba(255, 255, 255, 0.1) !important;
593
- border: 1px solid rgba(251, 191, 36, 0.5) !important;
594
  color: #fff !important;
595
  user-select: none !important;
596
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  """
598
 
599
  # ========== FILE MANAGEMENT JAVASCRIPT ==========
@@ -637,7 +665,7 @@ function updateWaveformForFile(fileInfo) {
637
  canvas.height = canvas.offsetHeight;
638
 
639
  ctx.clearRect(0, 0, canvas.width, canvas.height);
640
- ctx.strokeStyle = '#fbbf24';
641
  ctx.lineWidth = 2;
642
  ctx.beginPath();
643
 
@@ -660,7 +688,7 @@ function updateWaveformForFile(fileInfo) {
660
  }
661
  ctx.stroke();
662
 
663
- ctx.fillStyle = '#fbbf24';
664
  ctx.font = '12px monospace';
665
  ctx.fillText(fileInfo ? `${fileInfo.name}` : 'No file selected', 10, 20);
666
  }
@@ -761,25 +789,27 @@ def create_processed_file_html(files):
761
  <span style='font-size: 20px; font-weight: 600;'>Processed Files</span>
762
  <div style='margin-left: auto; display: flex; gap: 8px;'>
763
  <button onclick='saveSelectedFile()' style='
764
- background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
765
  border: none;
766
- color: #1f2937;
767
- padding: 8px 12px;
768
  border-radius: 6px;
769
  cursor: pointer;
770
  font-weight: 500;
771
  font-size: 13px;
772
- '>Save Selected</button>
 
773
  <button onclick='saveAllFiles()' style='
774
- background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
775
  border: none;
776
- color: #1f2937;
777
- padding: 8px 12px;
778
  border-radius: 6px;
779
  cursor: pointer;
780
  font-weight: 500;
781
  font-size: 13px;
782
- '>Save All</button>
 
783
  </div>
784
  </div>
785
  <div class='file-list' id='processed-file-list'>
@@ -814,25 +844,27 @@ def create_processed_file_html(files):
814
  <span style='font-size: 20px; font-weight: 600;'>Processed Files</span>
815
  <div style='margin-left: auto; display: flex; gap: 8px;'>
816
  <button onclick='saveSelectedFile()' style='
817
- background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
818
  border: none;
819
- color: #1f2937;
820
- padding: 8px 12px;
821
  border-radius: 6px;
822
  cursor: pointer;
823
  font-weight: 500;
824
  font-size: 13px;
825
- '>Save Selected</button>
 
826
  <button onclick='saveAllFiles()' style='
827
- background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
828
  border: none;
829
- color: #1f2937;
830
- padding: 8px 12px;
831
  border-radius: 6px;
832
  cursor: pointer;
833
  font-weight: 500;
834
  font-size: 13px;
835
- '>Save All</button>
 
836
  </div>
837
  </div>
838
  <div class='file-list' id='processed-file-list'>
@@ -951,14 +983,14 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Base()) as demo:
951
  with gr.Row():
952
  # Left panel - Input files
953
  with gr.Column(scale=1, min_width=250, elem_classes="file-column"):
954
- # File upload (hidden)
955
- file_upload = gr.File(
956
- label="Upload Audio Files",
957
- file_count="multiple",
958
- file_types=["audio"],
959
- visible=False,
960
- elem_id="file-upload"
961
- )
962
 
963
  # Input files display
964
  input_file_panel = gr.HTML(
@@ -966,10 +998,13 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Base()) as demo:
966
  elem_classes="file-panel-container"
967
  )
968
 
969
- # Upload button
970
- upload_btn = gr.Button(
971
- "📁 Upload Audio Files",
972
- elem_classes="upload-button"
 
 
 
973
  )
974
 
975
  # Center - Main content
 
383
  overflow: hidden !important;
384
  }
385
 
386
+ /* Clean modern design - Dark teal/coral theme */
387
  .gradio-container {
388
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
389
+ background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
390
  color: #fff;
391
  height: 100vh;
392
  max-height: 100vh;
 
455
  .file-panel-header {
456
  background: rgba(255, 255, 255, 0.15);
457
  padding: 15px;
458
+ border-bottom: 2px solid #ff6b6b;
459
  display: flex;
460
  align-items: center;
461
  gap: 10px;
 
484
  }
485
 
486
  .file-item:hover {
487
+ background: rgba(255, 107, 107, 0.3);
488
  transform: translateX(5px);
489
  }
490
 
491
  .file-item.selected {
492
+ background: rgba(255, 107, 107, 0.4);
493
+ border-left: 4px solid #ff6b6b;
494
  }
495
 
496
  /* Main content area */
 
513
  border: 1px solid rgba(255, 255, 255, 0.2);
514
  }
515
 
516
+ /* Button styling - Coral accent */
517
  .gr-button {
518
+ background: linear-gradient(135deg, #ff6b6b 0%, #ee5a50 100%) !important;
519
  border: none !important;
520
+ color: #fff !important;
521
  padding: 10px 20px !important;
522
  border-radius: 6px !important;
523
  font-weight: 600 !important;
 
525
  }
526
 
527
  .gr-button:hover {
528
+ background: linear-gradient(135deg, #ee5a50 0%, #e04545 100%) !important;
529
  transform: translateY(-2px) !important;
530
+ box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4) !important;
531
  }
532
 
533
  /* Slider styling */
534
  .gr-slider input {
535
+ accent-color: #ff6b6b !important;
536
  }
537
 
538
  /* Center slider values */
 
549
  position: relative;
550
  background: rgba(255, 255, 255, 0.1);
551
  backdrop-filter: blur(10px);
552
+ border: 1px solid rgba(255, 107, 107, 0.5);
553
  border-radius: 6px;
554
  padding: 0;
555
  margin-top: 20px;
 
562
  top: 0;
563
  left: 0;
564
  height: 100%;
565
+ background: linear-gradient(90deg, #ff6b6b, #ee5a50);
566
  width: 0%;
567
  transition: width 0.3s ease;
568
  }
 
590
  /* Dropdown styling */
591
  .gr-dropdown {
592
  background: rgba(255, 255, 255, 0.1) !important;
593
+ border: 1px solid rgba(255, 107, 107, 0.5) !important;
594
  color: #fff !important;
595
  user-select: none !important;
596
  }
597
+
598
+ /* Import button styling */
599
+ .upload-button {
600
+ width: 100% !important;
601
+ margin-bottom: 10px !important;
602
+ background: linear-gradient(135deg, #4ecdc4 0%, #44a3aa 100%) !important;
603
+ }
604
+
605
+ .upload-button:hover {
606
+ background: linear-gradient(135deg, #44a3aa 0%, #3a8f96 100%) !important;
607
+ }
608
+
609
+ /* File column layout fix */
610
+ .file-column > div {
611
+ display: flex;
612
+ flex-direction: column;
613
+ height: 100%;
614
+ }
615
+
616
+ .file-column .file-panel-container {
617
+ flex: 1 1 auto;
618
+ min-height: 0;
619
+ }
620
+
621
+ .file-column .gr-row:first-child {
622
+ flex: 0 0 auto;
623
+ padding: 10px 10px 0 10px;
624
+ }
625
  """
626
 
627
  # ========== FILE MANAGEMENT JAVASCRIPT ==========
 
665
  canvas.height = canvas.offsetHeight;
666
 
667
  ctx.clearRect(0, 0, canvas.width, canvas.height);
668
+ ctx.strokeStyle = '#ff6b6b';
669
  ctx.lineWidth = 2;
670
  ctx.beginPath();
671
 
 
688
  }
689
  ctx.stroke();
690
 
691
+ ctx.fillStyle = '#ff6b6b';
692
  ctx.font = '12px monospace';
693
  ctx.fillText(fileInfo ? `${fileInfo.name}` : 'No file selected', 10, 20);
694
  }
 
789
  <span style='font-size: 20px; font-weight: 600;'>Processed Files</span>
790
  <div style='margin-left: auto; display: flex; gap: 8px;'>
791
  <button onclick='saveSelectedFile()' style='
792
+ background: linear-gradient(135deg, #ff6b6b 0%, #ee5a50 100%);
793
  border: none;
794
+ color: #fff;
795
+ padding: 8px 16px;
796
  border-radius: 6px;
797
  cursor: pointer;
798
  font-weight: 500;
799
  font-size: 13px;
800
+ min-width: 90px;
801
+ '>Export</button>
802
  <button onclick='saveAllFiles()' style='
803
+ background: linear-gradient(135deg, #ff6b6b 0%, #ee5a50 100%);
804
  border: none;
805
+ color: #fff;
806
+ padding: 8px 16px;
807
  border-radius: 6px;
808
  cursor: pointer;
809
  font-weight: 500;
810
  font-size: 13px;
811
+ min-width: 90px;
812
+ '>Export All</button>
813
  </div>
814
  </div>
815
  <div class='file-list' id='processed-file-list'>
 
844
  <span style='font-size: 20px; font-weight: 600;'>Processed Files</span>
845
  <div style='margin-left: auto; display: flex; gap: 8px;'>
846
  <button onclick='saveSelectedFile()' style='
847
+ background: linear-gradient(135deg, #ff6b6b 0%, #ee5a50 100%);
848
  border: none;
849
+ color: #fff;
850
+ padding: 8px 16px;
851
  border-radius: 6px;
852
  cursor: pointer;
853
  font-weight: 500;
854
  font-size: 13px;
855
+ min-width: 90px;
856
+ '>Export</button>
857
  <button onclick='saveAllFiles()' style='
858
+ background: linear-gradient(135deg, #ff6b6b 0%, #ee5a50 100%);
859
  border: none;
860
+ color: #fff;
861
+ padding: 8px 16px;
862
  border-radius: 6px;
863
  cursor: pointer;
864
  font-weight: 500;
865
  font-size: 13px;
866
+ min-width: 90px;
867
+ '>Export All</button>
868
  </div>
869
  </div>
870
  <div class='file-list' id='processed-file-list'>
 
983
  with gr.Row():
984
  # Left panel - Input files
985
  with gr.Column(scale=1, min_width=250, elem_classes="file-column"):
986
+ # Import Audio button at the TOP
987
+ with gr.Row():
988
+ upload_btn = gr.Button(
989
+ "📁 Import Audio",
990
+ elem_classes="upload-button",
991
+ size="sm",
992
+ variant="primary"
993
+ )
994
 
995
  # Input files display
996
  input_file_panel = gr.HTML(
 
998
  elem_classes="file-panel-container"
999
  )
1000
 
1001
+ # File upload (hidden)
1002
+ file_upload = gr.File(
1003
+ label="Upload Audio Files",
1004
+ file_count="multiple",
1005
+ file_types=["audio"],
1006
+ visible=False,
1007
+ elem_id="file-upload"
1008
  )
1009
 
1010
  # Center - Main content