Spaces:
Runtime error
Runtime error
burraco135
commited on
Commit
•
280610d
1
Parent(s):
06aba51
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
-
iface = gr.Interface(fn=
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Load model directly
|
4 |
+
from transformers import AutoProcessor, SpeechT5ForTextToSpeech
|
5 |
+
|
6 |
+
processor = AutoProcessor.from_pretrained("burraco135/speecht5_finetuned_voxpopuli_it")
|
7 |
+
model = SpeechT5ForTextToSpeech.from_pretrained("burraco135/speecht5_finetuned_voxpopuli_it")
|
8 |
+
|
9 |
+
def tts(text):
|
10 |
+
inputs = processor(text=text, return_tensors="pt")
|
11 |
+
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
|
12 |
+
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
|
13 |
+
|
14 |
def greet(name):
|
15 |
return "Hello " + name + "!!"
|
16 |
|
17 |
+
iface = gr.Interface(fn=tts, inputs="text", outputs="audio")
|
18 |
iface.launch()
|