ggoknar
commited on
Commit
·
9cde7f1
1
Parent(s):
e0aeb7a
remove code part
Browse files
app.py
CHANGED
@@ -21,6 +21,7 @@ from scipy.io.wavfile import write
|
|
21 |
from pydub import AudioSegment
|
22 |
import ffmpeg
|
23 |
|
|
|
24 |
import io, wave
|
25 |
import librosa
|
26 |
import torchaudio
|
@@ -401,6 +402,8 @@ def generate_speech(history):
|
|
401 |
# Sometimes prompt </s> coming on output remove it
|
402 |
# Some post process for speech only
|
403 |
sentence = sentence.replace("</s>", "")
|
|
|
|
|
404 |
sentence = sentence.replace("```", "")
|
405 |
sentence = sentence.replace("```", "")
|
406 |
sentence = sentence.replace("(", " ")
|
|
|
21 |
from pydub import AudioSegment
|
22 |
import ffmpeg
|
23 |
|
24 |
+
import re
|
25 |
import io, wave
|
26 |
import librosa
|
27 |
import torchaudio
|
|
|
402 |
# Sometimes prompt </s> coming on output remove it
|
403 |
# Some post process for speech only
|
404 |
sentence = sentence.replace("</s>", "")
|
405 |
+
# remove code from speech
|
406 |
+
sentence = re.sub("```.*```", "", sentence, flags=re.DOTALL)
|
407 |
sentence = sentence.replace("```", "")
|
408 |
sentence = sentence.replace("```", "")
|
409 |
sentence = sentence.replace("(", " ")
|