Spaces:
Sleeping
Sleeping
TTS added
Browse files
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def greet(name):
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import scipy
|
3 |
+
from transformers import VitsModel, AutoTokenizer
|
4 |
+
import torch
|
5 |
+
|
6 |
+
model = VitsModel.from_pretrained("facebook/mms-tts-crh")
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained("facebook/mms-tts-crh")
|
8 |
|
9 |
def greet(name):
|
10 |
+
text = name
|
11 |
+
inputs = tokenizer(text, return_tensors="pt")
|
12 |
+
|
13 |
+
with torch.no_grad():
|
14 |
+
output = model(**inputs).waveform
|
15 |
+
|
16 |
+
return scipy.io.wavfile.write("techno.wav", rate=model.config.sampling_rate, data=output)
|
17 |
|
18 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
19 |
iface.launch()
|