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