tee342 commited on
Commit
847e7ea
Β·
verified Β·
1 Parent(s): 7b9755f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -54
app.py CHANGED
@@ -129,7 +129,7 @@ def apply_stage_mode(audio):
129
 
130
  # === Genre Mastering Presets ===
131
  genre_presets = {
132
- "Soul": ["Warmth", "Bass Boost (+6dB)", "Mid Enhance"],
133
  "Funk": ["Treble Boost (+6dB)", "Compression", "Stereo Widening"],
134
  "Rock": ["Distortion", "Punchy Mids", "Reverb"],
135
  "Pop": ["Vocal Clarity", "Limiter", "Stereo Expansion"],
@@ -410,46 +410,13 @@ def mix_tracks(track1, track2, volume_offset=0):
410
  # === Genre Mastering Tab ===
411
  def apply_genre_preset(audio, genre):
412
  global preset_choices
413
- selected_preset = preset_choices.get(genre, [])
414
- return process_audio(audio, selected_preset, False, genre, "WAV")
415
-
416
- with gr.Tab("🎧 Genre Mastering"):
417
- gr.Markdown("Apply pre-tuned mastering settings for different music genres.")
418
-
419
- genre_dropdown = gr.Dropdown(
420
- choices=list(genre_presets.keys()),
421
- label="Select Genre",
422
- value="Pop"
423
- )
424
-
425
- gr.Interface(
426
- fn=lambda audio, genre: apply_genre_preset(audio, genre)[0],
427
- inputs=[
428
- gr.Audio(label="Upload Track", type="filepath"),
429
- genre_dropdown
430
- ],
431
- outputs=gr.Audio(label="Mastered Output", type="filepath"),
432
- title="Genre-Specific Mastering",
433
- description="Apply professionally tuned presets for popular music genres."
434
- )
435
 
436
  # === Dummy Voice Cloning Tab – Works Locally Only ===
437
  def clone_voice(*args):
438
  return "⚠️ Voice cloning requires local install – use Python 3.9 or below"
439
 
440
- with gr.Tab("🎭 Voice Cloning (Local Only)"):
441
- gr.Interface(
442
- fn=clone_voice,
443
- inputs=[
444
- gr.File(label="Source Voice Clip"),
445
- gr.File(label="Target Voice Clip"),
446
- gr.Textbox(label="Text to Clone", lines=5)
447
- ],
448
- outputs=gr.Audio(label="Cloned Output", type="filepath"),
449
- title="Replace One Voice With Another",
450
- description="Clone voice from source to target speaker using AI"
451
- )
452
-
453
  # === Speaker Diarization ("Who Spoke When?") ===
454
  try:
455
  from pyannote.audio import Pipeline as DiarizationPipeline
@@ -473,6 +440,7 @@ def diarize_and_transcribe(audio_path):
473
  audio.export(temp_wav, format="wav")
474
 
475
  try:
 
476
  diarization = diarize_pipeline(temp_wav)
477
 
478
  result = whisper.transcribe(temp_wav)
@@ -549,7 +517,7 @@ with gr.Blocks(title="AI Audio Studio", css="style.css") as demo:
549
  gr.File(label="Upload Multiple Files", file_count="multiple"),
550
  gr.CheckboxGroup(choices=effect_options, label="Apply Effects in Order"),
551
  gr.Checkbox(label="Isolate Vocals After Effects"),
552
- gr.Dropdown(choices=preset_names, label="Select Preset", value=preset_names[0]),
553
  gr.Dropdown(choices=["MP3", "WAV"], label="Export Format", value="MP3")
554
  ],
555
  outputs=[
@@ -583,15 +551,14 @@ with gr.Blocks(title="AI Audio Studio", css="style.css") as demo:
583
  # --- Genre Mastering Tab ===
584
  with gr.Tab("🎧 Genre Mastering"):
585
  gr.Interface(
586
- fn=lambda audio, genre: apply_genre_preset(audio, genre)[0],
587
  inputs=[
588
  gr.Audio(label="Upload Track", type="filepath"),
589
  gr.Dropdown(choices=list(genre_presets.keys()), label="Select Genre", value="Pop")
590
  ],
591
  outputs=gr.Audio(label="Mastered Output", type="filepath"),
592
  title="Genre-Specific Mastering",
593
- description="Apply professionally tuned presets for popular music genres.",
594
- allow_flagging="never"
595
  )
596
 
597
  # --- Transcribe & Edit Tab ===
@@ -713,18 +680,4 @@ with gr.Blocks(title="AI Audio Studio", css="style.css") as demo:
713
  description="Load your saved session"
714
  )
715
 
716
- # --- Mix Two Tracks ===
717
- with gr.Tab(" remix mode"),
718
- gr.Interface(
719
- fn=mix_tracks,
720
- inputs=[
721
- gr.File(label="Main Track"),
722
- gr.File(label="Background Track"),
723
- gr.Slider(minimum=-10, maximum=10, value=0, label="Volume Offset (dB)")
724
- ],
725
- outputs=gr.File(label="Mixed Output"),
726
- title="Overlay Two Tracks",
727
- description="Mix, blend, or subtract two audio files."
728
- )
729
-
730
  demo.launch()
 
129
 
130
  # === Genre Mastering Presets ===
131
  genre_presets = {
132
+ "Soul": ["Noise Reduction", "Bass Boost (+6dB)", "Mid Enhance"],
133
  "Funk": ["Treble Boost (+6dB)", "Compression", "Stereo Widening"],
134
  "Rock": ["Distortion", "Punchy Mids", "Reverb"],
135
  "Pop": ["Vocal Clarity", "Limiter", "Stereo Expansion"],
 
410
  # === Genre Mastering Tab ===
411
  def apply_genre_preset(audio, genre):
412
  global preset_choices
413
+ selected_preset = genre_presets.get(genre, [])
414
+ return process_audio(audio, selected_preset, False, genre, "WAV")[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
 
416
  # === Dummy Voice Cloning Tab – Works Locally Only ===
417
  def clone_voice(*args):
418
  return "⚠️ Voice cloning requires local install – use Python 3.9 or below"
419
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  # === Speaker Diarization ("Who Spoke When?") ===
421
  try:
422
  from pyannote.audio import Pipeline as DiarizationPipeline
 
440
  audio.export(temp_wav, format="wav")
441
 
442
  try:
443
+ from pyannote.audio import Pipeline as DiarizationPipeline
444
  diarization = diarize_pipeline(temp_wav)
445
 
446
  result = whisper.transcribe(temp_wav)
 
517
  gr.File(label="Upload Multiple Files", file_count="multiple"),
518
  gr.CheckboxGroup(choices=effect_options, label="Apply Effects in Order"),
519
  gr.Checkbox(label="Isolate Vocals After Effects"),
520
+ gr.Dropdown(choices=preset_names, label="Select Preset", value=preset_names[0] if preset_names else None),
521
  gr.Dropdown(choices=["MP3", "WAV"], label="Export Format", value="MP3")
522
  ],
523
  outputs=[
 
551
  # --- Genre Mastering Tab ===
552
  with gr.Tab("🎧 Genre Mastering"):
553
  gr.Interface(
554
+ fn=lambda audio, genre: apply_genre_preset(audio, genre),
555
  inputs=[
556
  gr.Audio(label="Upload Track", type="filepath"),
557
  gr.Dropdown(choices=list(genre_presets.keys()), label="Select Genre", value="Pop")
558
  ],
559
  outputs=gr.Audio(label="Mastered Output", type="filepath"),
560
  title="Genre-Specific Mastering",
561
+ description="Apply professionally tuned presets for popular music genres."
 
562
  )
563
 
564
  # --- Transcribe & Edit Tab ===
 
680
  description="Load your saved session"
681
  )
682
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
  demo.launch()