Anita-19 commited on
Commit
aa94b61
·
verified ·
1 Parent(s): c465cd6

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -0
main.py CHANGED
@@ -248,6 +248,17 @@ save_path = "/content/drive/My Drive/fine_tuned_tacotron2.pth"
248
  # Save the model's state dictionary using torch.save
249
  torch.save(model.state_dict(), save_path)
250
 
 
 
 
 
 
 
 
 
 
 
 
251
  """Set up the Gradio interface"""
252
 
253
  import gradio as gr
 
248
  # Save the model's state dictionary using torch.save
249
  torch.save(model.state_dict(), save_path)
250
 
251
+ import librosa
252
+ import soundfile as sf
253
+
254
+ def adjust_pitch(audio_path, pitch_factor):
255
+ # Load audio
256
+ y, sr = librosa.load(audio_path)
257
+ # Adjust pitch
258
+ y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=pitch_factor)
259
+ # Save adjusted audio
260
+ sf.write(audio_path, y_shifted, sr)
261
+
262
  """Set up the Gradio interface"""
263
 
264
  import gradio as gr