Spaces:
Running
Running
huseinzol05
commited on
Commit
•
aaaeccd
1
Parent(s):
ba62645
add initial
Browse files- README.md +2 -2
- app.py +48 -0
- packages.txt +1 -0
- requirements.txt +7 -0
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: pink
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
|
|
1 |
---
|
2 |
+
title: E2E-TTS VITS
|
3 |
+
emoji: 🦜
|
4 |
colorFrom: pink
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
app.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
os.environ['CUDA_VISIBLE_DEVICES'] = ''
|
4 |
+
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
|
5 |
+
|
6 |
+
import malaya_speech
|
7 |
+
from malaya_speech.utils.astype import float_to_int
|
8 |
+
import gradio as gr
|
9 |
+
import logging
|
10 |
+
import json
|
11 |
+
|
12 |
+
logging.basicConfig(level=logging.INFO)
|
13 |
+
|
14 |
+
MODELS = {}
|
15 |
+
AVAILABLE_MODELS = malaya_speech.tts.available_vits().index.tolist()
|
16 |
+
|
17 |
+
def tts(text, model, temperature, length_ratio):
|
18 |
+
global MODELS
|
19 |
+
if model not in MODELS:
|
20 |
+
MODELS[model] = malaya_speech.tts.vits(model=model)
|
21 |
+
|
22 |
+
r = MODELS[model].predict(
|
23 |
+
text,
|
24 |
+
temperature = temperature,
|
25 |
+
length_ratio = length_ratio,
|
26 |
+
)
|
27 |
+
data = float_to_int(r['y'])
|
28 |
+
return (22050, data)
|
29 |
+
|
30 |
+
demo = gr.Interface(
|
31 |
+
fn=tts,
|
32 |
+
inputs=[
|
33 |
+
gr.components.Textbox(label='Text'),
|
34 |
+
gr.components.Dropdown(label='Available models', choices=AVAILABLE_MODELS, value = 'mesolitica/VITS-osman'),
|
35 |
+
gr.Slider(0.0, 1.0, value=0.6666, label='temperature, changing this will manipulate pitch'),
|
36 |
+
gr.Slider(0.0, 3.0, value=1.0, label='length ratio, changing this will manipulate duration output'),
|
37 |
+
],
|
38 |
+
outputs=['audio'],
|
39 |
+
examples=[
|
40 |
+
['Syed Saddiq berkata, mereka seharusnya mengingati bahawa semasa menjadi Perdana Menteri Pakatan Harapan', 'mesolitica/VITS-osman', 0.6666, 1.0],
|
41 |
+
['SHAH ALAM - Pertubuhan Kebajikan Anak Bersatu Selangor bersetuju pihak kerajaan mewujudkan Suruhanjaya Siasatan Diraja untuk menyiasat isu kartel daging.', 'mesolitica/VITS-haqkiem', 0.6666, 1.0],
|
42 |
+
],
|
43 |
+
cache_examples=False,
|
44 |
+
title='End-to-End TTS using VITS from Mesolitica',
|
45 |
+
)
|
46 |
+
|
47 |
+
demo.launch(server_name='0.0.0.0')
|
48 |
+
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
libsndfile1
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
malaya-speech
|
2 |
+
malaya
|
3 |
+
tensorflow==2.9.2
|
4 |
+
torch==1.12.1
|
5 |
+
malaya-boilerplate==0.0.23
|
6 |
+
matplotlib
|
7 |
+
transformers
|