m6011 commited on
Commit
ed4d752
1 Parent(s): 93097a6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import Tacotron2Processor, Tacotron2ForConditionalGeneration
3
+
4
+ # تحميل النموذج والمعالج
5
+ processor = Tacotron2Processor.from_pretrained("facebook/tacotron2")
6
+ model = Tacotron2ForConditionalGeneration.from_pretrained("facebook/tacotron2")
7
+
8
+ def tts(text):
9
+ inputs = processor(text, return_tensors="pt")
10
+ speech = model.generate(**inputs)
11
+ return processor.decode(speech[0])
12
+
13
+ # واجهة Gradio
14
+ iface = gr.Interface(fn=tts, inputs="text", outputs="audio", title="Najdi TTS Model")
15
+ iface.launch()