helloWorld199 commited on
Commit
4589722
1 Parent(s): fd62b34

Update src/main.py

Browse files
Files changed (1) hide show
  1. src/main.py +10 -0
src/main.py CHANGED
@@ -232,6 +232,13 @@ def combine_audio(audio_paths, output_path, main_gain, backup_gain, inst_gain, o
232
  #instrumental_audio = AudioSegment.from_wav(audio_paths[2]) - 7 + inst_gain
233
  main_vocal_audio.overlay(backup_vocal_audio).export(output_path, format=output_format)
234
 
 
 
 
 
 
 
 
235
  # song_input is the main vocals that is going through the rvc processs
236
  # backup vocals are the backup vocals to be added at the end
237
  def song_cover_pipeline(main_vocals, backup_vocals, voice_model, pitch_change, keep_files,
@@ -239,6 +246,9 @@ def song_cover_pipeline(main_vocals, backup_vocals, voice_model, pitch_change, k
239
  rms_mix_rate=0.25, f0_method='rmvpe', crepe_hop_length=128, protect=0.33, pitch_change_all=0,
240
  reverb_rm_size=0.15, reverb_wet=0.2, reverb_dry=0.8, reverb_damping=0.7, output_format='mp3',
241
  progress=gr.Progress()):
 
 
 
242
  try:
243
  print(f"DEBUG PRINT: main_vocals: {main_vocals}, backup_vocals: {backup_vocals}")
244
  if not main_vocals or not voice_model:
 
232
  #instrumental_audio = AudioSegment.from_wav(audio_paths[2]) - 7 + inst_gain
233
  main_vocal_audio.overlay(backup_vocal_audio).export(output_path, format=output_format)
234
 
235
+ def remove_files_and_folders(folder_path):
236
+ try:
237
+ shutil.rmtree(folder_path)
238
+ print(f"All files and folders inside {folder_path} have been removed.")
239
+ except Exception as e:
240
+ print(f"An error occurred: {e}")
241
+
242
  # song_input is the main vocals that is going through the rvc processs
243
  # backup vocals are the backup vocals to be added at the end
244
  def song_cover_pipeline(main_vocals, backup_vocals, voice_model, pitch_change, keep_files,
 
246
  rms_mix_rate=0.25, f0_method='rmvpe', crepe_hop_length=128, protect=0.33, pitch_change_all=0,
247
  reverb_rm_size=0.15, reverb_wet=0.2, reverb_dry=0.8, reverb_damping=0.7, output_format='mp3',
248
  progress=gr.Progress()):
249
+ print("Cleaning gradio cache ...")
250
+ remove_files_and_folders("/tmp/gradio/")
251
+ print("Done")
252
  try:
253
  print(f"DEBUG PRINT: main_vocals: {main_vocals}, backup_vocals: {backup_vocals}")
254
  if not main_vocals or not voice_model: