tee342 commited on
Commit
1383c4e
·
verified ·
1 Parent(s): 67cba8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -21
app.py CHANGED
@@ -23,7 +23,6 @@ import base64
23
  import pickle
24
  import json
25
  import soundfile as sf
26
- from moviepy.editor import VideoFileClip, AudioFileClip
27
 
28
  # Suppress warnings
29
  warnings.filterwarnings("ignore")
@@ -550,23 +549,6 @@ def clone_voice(source_audio, reference_audio):
550
  mixed.export(out_path, format="wav")
551
  return out_path
552
 
553
- # === Video Sync Mode – Extract and re-sync audio ===
554
- def extract_audio_from_video(video_path):
555
- clip = VideoFileClip(video_path)
556
- out_path = os.path.join(tempfile.gettempdir(), "video_audio.wav")
557
- clip.audio.write_audiofile(out_path)
558
- return out_path
559
-
560
- def re_sync_audio(video_path, edited_audio_path):
561
- original_clip = VideoFileClip(video_path)
562
- edited_audio = AudioSegment.from_file(edited_audio_path)
563
- temp_audio_path = os.path.join(tempfile.gettempdir(), "temp_edited.mp3")
564
- edited_audio.export(temp_audio_path, format="mp3")
565
- final_clip = original_clip.set_audio(temp_audio_path)
566
- out_path = os.path.join(tempfile.gettempdir(), "final_video.mp4")
567
- final_clip.write_videofile(out_path, codec="libx264", audio_codec="aac")
568
- return out_path
569
-
570
  # === Main UI – With Studio Pulse Branding ===
571
  with gr.Blocks(css="""
572
  body {
@@ -942,7 +924,7 @@ with gr.Blocks(css="""
942
  fn=live_effect_preview,
943
  inputs=[
944
  gr.Audio(sources=["microphone"], streaming=True, label="Live Mic Input"),
945
- gr.Dropdown(choices=["Normalize", "Reverb", "Pitch Shift", "Saturation"]),
946
  ],
947
  outputs=gr.Audio(label="Live Output", type="filepath"),
948
  title="Preview Effects in Real-Time",
@@ -1043,7 +1025,7 @@ with gr.Blocks(css="""
1043
  ### Keyboard Controls
1044
  - `Ctrl + Z`: Undo last effect
1045
  - `Ctrl + Y`: Redo
1046
- - `Spacebar`: Play/Stop playback
1047
  - `Ctrl + S`: Save current session
1048
  - `Ctrl + O`: Open session
1049
  - `Ctrl + C`: Copy effect chain
@@ -1060,7 +1042,7 @@ with gr.Blocks(css="""
1060
  ],
1061
  outputs=gr.Audio(label="Natural-Sounding Vocal", type="filepath"),
1062
  title="Preserve Vocal Quality During Pitch Shift",
1063
- description="Make pitch-shifted vocals sound more natural"
1064
  )
1065
 
1066
  # --- Voice Swap / Cloning – New Tab ===
 
23
  import pickle
24
  import json
25
  import soundfile as sf
 
26
 
27
  # Suppress warnings
28
  warnings.filterwarnings("ignore")
 
549
  mixed.export(out_path, format="wav")
550
  return out_path
551
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
  # === Main UI – With Studio Pulse Branding ===
553
  with gr.Blocks(css="""
554
  body {
 
924
  fn=live_effect_preview,
925
  inputs=[
926
  gr.Audio(sources=["microphone"], streaming=True, label="Live Mic Input"),
927
+ gr.Dropdown(choices=["Normalize", "Reverb", "Pitch Shift", "Saturation"], label="Effect", value="Normalize")
928
  ],
929
  outputs=gr.Audio(label="Live Output", type="filepath"),
930
  title="Preview Effects in Real-Time",
 
1025
  ### Keyboard Controls
1026
  - `Ctrl + Z`: Undo last effect
1027
  - `Ctrl + Y`: Redo
1028
+ - `Spacebar`: Play/Stop
1029
  - `Ctrl + S`: Save current session
1030
  - `Ctrl + O`: Open session
1031
  - `Ctrl + C`: Copy effect chain
 
1042
  ],
1043
  outputs=gr.Audio(label="Natural-Sounding Vocal", type="filepath"),
1044
  title="Preserve Vocal Quality During Pitch Shift",
1045
+ description="Make pitch-shifted vocals sound more human"
1046
  )
1047
 
1048
  # --- Voice Swap / Cloning – New Tab ===