AdamHider commited on
Commit
9b71340
1 Parent(s): 234fe6c
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -1,3 +1,21 @@
1
  import gradio as gr
 
 
 
2
 
3
- gr.Interface.load("models/facebook/mms-tts-crh").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
+ 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()