Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -51,25 +51,14 @@ import subprocess
|
|
51 |
|
52 |
import whisper
|
53 |
model1 = whisper.load_model("small")
|
54 |
-
os.system('pip install voicefixer --upgrade')
|
55 |
-
from voicefixer import VoiceFixer
|
56 |
-
voicefixer = VoiceFixer()
|
57 |
-
import openai
|
58 |
-
import torchaudio
|
59 |
-
from speechbrain.pretrained import SpectralMaskEnhancement
|
60 |
|
61 |
-
|
62 |
-
source="speechbrain/metricgan-plus-voicebank",
|
63 |
-
savedir="pretrained_models/metricgan-plus-voicebank",
|
64 |
-
run_opts={"device":"cuda"},
|
65 |
-
)
|
66 |
|
67 |
mes = [
|
68 |
{"role": "system", "content": "You are my personal assistant. Try to be helpful. Respond to me only in Chinese."}
|
69 |
]
|
70 |
|
71 |
|
72 |
-
|
73 |
'''
|
74 |
from google.colab import drive
|
75 |
drive.mount('/content/drive')
|
@@ -231,19 +220,7 @@ def voice_conversion(ta, ra, da):
|
|
231 |
# print("Reference Audio after decoder:")
|
232 |
# IPython.display.display(Audio(ref_wav_voc, rate=ap.sample_rate))
|
233 |
|
234 |
-
|
235 |
-
output="audio1.wav", # output wav file path
|
236 |
-
cuda=True, # whether to use gpu acceleration
|
237 |
-
mode = 0) # You can try out mode 0, 1, or 2 to find out the best result
|
238 |
-
|
239 |
-
noisy = enhance_model.load_audio(
|
240 |
-
"audio1.wav"
|
241 |
-
).unsqueeze(0)
|
242 |
-
|
243 |
-
enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
|
244 |
-
torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
|
245 |
-
|
246 |
-
return "enhanced.wav"
|
247 |
|
248 |
block = gr.Blocks()
|
249 |
|
|
|
51 |
|
52 |
import whisper
|
53 |
model1 = whisper.load_model("small")
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
import openai
|
|
|
|
|
|
|
|
|
56 |
|
57 |
mes = [
|
58 |
{"role": "system", "content": "You are my personal assistant. Try to be helpful. Respond to me only in Chinese."}
|
59 |
]
|
60 |
|
61 |
|
|
|
62 |
'''
|
63 |
from google.colab import drive
|
64 |
drive.mount('/content/drive')
|
|
|
220 |
# print("Reference Audio after decoder:")
|
221 |
# IPython.display.display(Audio(ref_wav_voc, rate=ap.sample_rate))
|
222 |
|
223 |
+
return (ap.sample_rate, ref_wav_voc)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
|
225 |
block = gr.Blocks()
|
226 |
|