Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,15 +43,6 @@ import numpy as np
|
|
| 43 |
import IPython
|
| 44 |
from IPython.display import Audio
|
| 45 |
|
| 46 |
-
import torchaudio
|
| 47 |
-
from speechbrain.pretrained import SpectralMaskEnhancement
|
| 48 |
-
|
| 49 |
-
enhance_model = SpectralMaskEnhancement.from_hparams(
|
| 50 |
-
source="speechbrain/metricgan-plus-voicebank",
|
| 51 |
-
savedir="pretrained_models/metricgan-plus-voicebank",
|
| 52 |
-
run_opts={"device":"cuda"},
|
| 53 |
-
)
|
| 54 |
-
|
| 55 |
from TTS.tts.utils.synthesis import synthesis
|
| 56 |
from TTS.tts.utils.text.symbols import make_symbols, phonemes, symbols
|
| 57 |
try:
|
|
@@ -186,14 +177,7 @@ def greet(Text,Voicetoclone,VoiceMicrophone):
|
|
| 186 |
cuda=True, # whether to use gpu acceleration'
|
| 187 |
mode = 0) # You can try out mode 0, 1, or 2 to find out the best result
|
| 188 |
|
| 189 |
-
|
| 190 |
-
"audio1.wav"
|
| 191 |
-
).unsqueeze(0)
|
| 192 |
-
|
| 193 |
-
enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
|
| 194 |
-
torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
|
| 195 |
-
|
| 196 |
-
return "enhanced.wav"
|
| 197 |
|
| 198 |
def generate_prompt(instruction, input=None):
|
| 199 |
if input:
|
|
|
|
| 43 |
import IPython
|
| 44 |
from IPython.display import Audio
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
from TTS.tts.utils.synthesis import synthesis
|
| 47 |
from TTS.tts.utils.text.symbols import make_symbols, phonemes, symbols
|
| 48 |
try:
|
|
|
|
| 177 |
cuda=True, # whether to use gpu acceleration'
|
| 178 |
mode = 0) # You can try out mode 0, 1, or 2 to find out the best result
|
| 179 |
|
| 180 |
+
return "audio1.wav"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
def generate_prompt(instruction, input=None):
|
| 183 |
if input:
|