Spaces:
Sleeping
Sleeping
add
Browse files
app.py
CHANGED
@@ -1,3 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
global model, tokenizer
|
11 |
+
text = name
|
12 |
+
|
13 |
+
inputs = tokenizer(text, return_tensors="pt")
|
14 |
+
|
15 |
+
with torch.no_grad():
|
16 |
+
output = model(**inputs).waveform
|
17 |
+
|
18 |
+
return output
|
19 |
+
|
20 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="audio")
|
21 |
+
iface.launch()
|