File size: 453 Bytes
03fc43e
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import gradio as gr
from transformers import VitsModel, AutoTokenizer
import torch
def TTS(text):
   model = VitsModel.from_pretrained("SeyedAli/Persian-Speech-synthesis")
   tokenizer = AutoTokenizer.from_pretrained("SeyedAli/Persian-Speech-synthesis")
   pipe = pipeline("text-to-speech", model=model,tokenizer=tokenizer)
   text = "من با ژاله جلسه داشتم."

iface = gr.Interface(fn=TTS, inputs=text, outputs=pipe(text))
iface.launch()