Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| import numpy as np | |
| # Model Load | |
| try: | |
| tts = pipeline("text-to-speech", model="facebook/mms-tts-mya") | |
| except Exception as e: | |
| tts = None | |
| def generate_audio(text): | |
| if tts is None: | |
| return None | |
| # Output: (sampling_rate, audio_array) | |
| output = tts(text) | |
| return (output["sampling_rate"], output["audio"][0]) | |
| # Interface | |
| demo = gr.Interface( | |
| fn=generate_audio, | |
| inputs="text", | |
| outputs="audio", | |
| title="Myanmar MMS-TTS" | |
| ) | |
| demo.launch() | |