Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,22 +23,13 @@ db = get_db_firestore()
|
|
| 23 |
asr = pipeline("automatic-speech-recognition", "facebook/wav2vec2-base-960h")
|
| 24 |
|
| 25 |
MODEL_NAMES = [
|
| 26 |
-
# "en/ek1/tacotron2",
|
| 27 |
"en/ljspeech/tacotron2-DDC",
|
| 28 |
-
# "en/ljspeech/tacotron2-DDC_ph",
|
| 29 |
"en/ljspeech/glow-tts",
|
| 30 |
-
# "en/ljspeech/tacotron2-DCA",
|
| 31 |
"en/ljspeech/speedy-speech-wn",
|
| 32 |
"en/ljspeech/vits",
|
| 33 |
-
"en/vctk/sc-glow-tts",
|
| 34 |
-
"en/vctk/vits",
|
| 35 |
"en/sam/tacotron-DDC",
|
| 36 |
-
# "es/mai/tacotron2-DDC",
|
| 37 |
"fr/mai/tacotron2-DDC",
|
| 38 |
-
#"zh-CN/baker/tacotron2-DDC-GST",
|
| 39 |
-
#"nl/mai/tacotron2-DDC",
|
| 40 |
"de/thorsten/tacotron2-DCA",
|
| 41 |
-
# "ja/kokoro/tacotron2-DDC",
|
| 42 |
]
|
| 43 |
MODELS = {}
|
| 44 |
manager = ModelManager()
|
|
@@ -89,9 +80,6 @@ def selectall(text):
|
|
| 89 |
docs = db.collection('Text2SpeechSentimentSave').stream()
|
| 90 |
doclist=''
|
| 91 |
for doc in docs:
|
| 92 |
-
#docid=doc.id
|
| 93 |
-
#dict=doc.to_dict()
|
| 94 |
-
#doclist+=doc.to_dict()
|
| 95 |
r=(f'{doc.id} => {doc.to_dict()}')
|
| 96 |
doclist += r
|
| 97 |
return doclist
|
|
@@ -102,15 +90,12 @@ def tts(text: str, model_name: str):
|
|
| 102 |
if synthesizer is None:
|
| 103 |
raise NameError("model not found")
|
| 104 |
wavs = synthesizer.tts(text)
|
| 105 |
-
# output = (synthesizer.output_sample_rate, np.array(wavs))
|
| 106 |
-
# return output
|
| 107 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
| 108 |
synthesizer.save_wav(wavs, fp)
|
| 109 |
return fp.name
|
| 110 |
|
| 111 |
demo = gr.Blocks()
|
| 112 |
with demo:
|
| 113 |
-
#audio_file = gr.Audio(type="filepath")
|
| 114 |
audio_file = gr.inputs.Audio(source="microphone", type="filepath")
|
| 115 |
text = gr.Textbox()
|
| 116 |
label = gr.Label()
|
|
|
|
| 23 |
asr = pipeline("automatic-speech-recognition", "facebook/wav2vec2-base-960h")
|
| 24 |
|
| 25 |
MODEL_NAMES = [
|
|
|
|
| 26 |
"en/ljspeech/tacotron2-DDC",
|
|
|
|
| 27 |
"en/ljspeech/glow-tts",
|
|
|
|
| 28 |
"en/ljspeech/speedy-speech-wn",
|
| 29 |
"en/ljspeech/vits",
|
|
|
|
|
|
|
| 30 |
"en/sam/tacotron-DDC",
|
|
|
|
| 31 |
"fr/mai/tacotron2-DDC",
|
|
|
|
|
|
|
| 32 |
"de/thorsten/tacotron2-DCA",
|
|
|
|
| 33 |
]
|
| 34 |
MODELS = {}
|
| 35 |
manager = ModelManager()
|
|
|
|
| 80 |
docs = db.collection('Text2SpeechSentimentSave').stream()
|
| 81 |
doclist=''
|
| 82 |
for doc in docs:
|
|
|
|
|
|
|
|
|
|
| 83 |
r=(f'{doc.id} => {doc.to_dict()}')
|
| 84 |
doclist += r
|
| 85 |
return doclist
|
|
|
|
| 90 |
if synthesizer is None:
|
| 91 |
raise NameError("model not found")
|
| 92 |
wavs = synthesizer.tts(text)
|
|
|
|
|
|
|
| 93 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
| 94 |
synthesizer.save_wav(wavs, fp)
|
| 95 |
return fp.name
|
| 96 |
|
| 97 |
demo = gr.Blocks()
|
| 98 |
with demo:
|
|
|
|
| 99 |
audio_file = gr.inputs.Audio(source="microphone", type="filepath")
|
| 100 |
text = gr.Textbox()
|
| 101 |
label = gr.Label()
|