Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
# Facebook MMS Model ကို လှမ်းဆွဲပြီး Run ပါမယ်
|
| 6 |
+
tts = pipeline("text-to-speech", model="facebook/mms-tts-mya")
|
| 7 |
+
|
| 8 |
+
def generate_audio(text):
|
| 9 |
+
# အသံထုတ်ပေးမယ့် Function
|
| 10 |
+
output = tts(text)
|
| 11 |
+
return (output["sampling_rate"], output["audio"][0])
|
| 12 |
+
|
| 13 |
+
# Web Interface ဖန်တီးခြင်း
|
| 14 |
+
demo = gr.Interface(
|
| 15 |
+
fn=generate_audio,
|
| 16 |
+
inputs=gr.Textbox(label="Input Text"),
|
| 17 |
+
outputs=gr.Audio(label="Generated Audio", type="numpy"),
|
| 18 |
+
title="Myanmar MMS-TTS Server"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
demo.launch()
|