Commit
·
b90bab6
0
Parent(s):
Duplicate from Gradio-Blocks/neon-tts-plugin-coqui
Browse filesCo-authored-by: Neon Bohdan <[email protected]>
- .gitattributes +27 -0
- .gitignore +1 -0
- README.md +15 -0
- app.py +67 -0
- packages.txt +2 -0
- requirements.txt +1 -0
.gitattributes
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.env
|
README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: NeonAI Coqui AI TTS Plugin
|
| 3 |
+
emoji: 🐸
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
python_version: 3.9
|
| 8 |
+
sdk_version: 3.2
|
| 9 |
+
app_file: app.py
|
| 10 |
+
pinned: true
|
| 11 |
+
license: bsd-3-clause
|
| 12 |
+
duplicated_from: Gradio-Blocks/neon-tts-plugin-coqui
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
app.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import tempfile
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
from neon_tts_plugin_coqui import CoquiTTS
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
LANGUAGES = list(CoquiTTS.langs.keys())
|
| 9 |
+
default_lang = "en"
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
title = "🐸💬 - NeonAI Coqui AI TTS Plugin"
|
| 14 |
+
description = "🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production"
|
| 15 |
+
info = "more info at [Neon Coqui TTS Plugin](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui), [Coqui TTS](https://github.com/coqui-ai/TTS)"
|
| 16 |
+
badge = "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=neongeckocom.neon-tts-plugin-coqui"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
coquiTTS = CoquiTTS()
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def tts(text: str, language: str):
|
| 24 |
+
print(text, language)
|
| 25 |
+
# return output
|
| 26 |
+
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
| 27 |
+
coquiTTS.get_tts(text, fp, speaker = {"language" : language})
|
| 28 |
+
return fp.name
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
with gr.Blocks() as blocks:
|
| 33 |
+
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>"
|
| 34 |
+
+ title
|
| 35 |
+
+ "</h1>")
|
| 36 |
+
gr.Markdown(description)
|
| 37 |
+
with gr.Row():# equal_height=False
|
| 38 |
+
with gr.Column():# variant="panel"
|
| 39 |
+
textbox = gr.Textbox(
|
| 40 |
+
label="Input",
|
| 41 |
+
value=CoquiTTS.langs[default_lang]["sentence"],
|
| 42 |
+
max_lines=3,
|
| 43 |
+
)
|
| 44 |
+
radio = gr.Radio(
|
| 45 |
+
label="Language",
|
| 46 |
+
choices=LANGUAGES,
|
| 47 |
+
value=default_lang
|
| 48 |
+
)
|
| 49 |
+
with gr.Row():# mobile_collapse=False
|
| 50 |
+
submit = gr.Button("Submit", variant="primary")
|
| 51 |
+
audio = gr.Audio(label="Output", interactive=False)
|
| 52 |
+
gr.Markdown(info)
|
| 53 |
+
gr.Markdown("<center>"
|
| 54 |
+
+f'<img src={badge} alt="visitors badge"/>'
|
| 55 |
+
+"</center>")
|
| 56 |
+
|
| 57 |
+
# actions
|
| 58 |
+
submit.click(
|
| 59 |
+
tts,
|
| 60 |
+
[textbox, radio],
|
| 61 |
+
[audio],
|
| 62 |
+
)
|
| 63 |
+
radio.change(lambda lang: CoquiTTS.langs[lang]["sentence"], radio, textbox)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
blocks.launch()
|
packages.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
libsndfile1
|
| 2 |
+
espeak-ng
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
neon-tts-plugin-coqui==0.6.0
|