| import gradio as gr |
| from enum import Enum |
|
|
| class StressOption(Enum): |
| AutomaticStress = "Автоматичні наголоси (за словником) 📖" |
| AutomaticStressWithModel = "Автоматичні наголоси (за допомогою моделі) 🧮" |
|
|
|
|
| class VoiceOption(Enum): |
| FemaleVoice = "Олена (жіночий) 👩" |
| MaleVoice = "Микита (чоловічий) 👨" |
|
|
| badge = ( |
| "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=robinhad.ukrainian-tts" |
| ) |
|
|
| iface = gr.Interface( |
| fn=lambda *args: [None, None], |
| inputs=[ |
| gr.inputs.Textbox( |
| label="Input", |
| default="Введіть, будь ласка, своє р+ечення.", |
| ), |
| gr.inputs.Radio( |
| label="Голос", |
| choices=[option.value for option in VoiceOption], |
| default=VoiceOption.FemaleVoice.value, |
| ), |
| gr.inputs.Radio( |
| label="Наголоси", |
| choices=[option.value for option in StressOption], |
| ), |
| ], |
| outputs=[ |
| gr.outputs.Audio(label="Output"), |
| gr.outputs.Textbox(label="Наголошений текст"), |
| ], |
| title="🐸💬🇺🇦 - Coqui TTS", |
| description="Україномовний🇺🇦 TTS за допомогою Coqui TTS (щоб вручну поставити наголос, використовуйте + перед голосною)", |
| article="Якщо вам подобається, підтримайте за посиланням: [SUPPORT LINK](https://send.monobank.ua/jar/48iHq4xAXm), " |
| + "Github: [https://github.com/robinhad/ukrainian-tts](https://github.com/robinhad/ukrainian-tts) \n" |
| + "Model training - [Yurii Paniv @robinhad](https://github.com/robinhad) \n" |
| + "Mykyta and Olena dataset - [Yehor Smoliakov @egorsmkv](https://github.com/egorsmkv) \n" |
| + "Autostress (with dictionary) using [ukrainian-word-stress](https://github.com/lang-uk/ukrainian-word-stress) - [Oleksiy Syvokon @asivokon](https://github.com/asivokon) \n" |
| + "Autostress (with model) using [ukrainian-accentor](https://github.com/egorsmkv/ukrainian-accentor) - [Bohdan Mykhailenko @NeonBohdan](https://github.com/NeonBohdan) + [Yehor Smoliakov @egorsmkv](https://github.com/egorsmkv) \n" |
| + f'<center><img src="{badge}" alt="visitors badge"/></center>', |
| examples=[ |
| [ |
| "Введіть, будь ласка, своє речення.", |
| VoiceOption.FemaleVoice.value, |
| StressOption.AutomaticStress.value, |
| ], |
| [ |
| "Введіть, будь ласка, своє речення.", |
| VoiceOption.MaleVoice.value, |
| StressOption.AutomaticStress.value, |
| ], |
| [ |
| "Вв+едіть, будь ласка, св+оє реч+ення.", |
| VoiceOption.MaleVoice.value, |
| StressOption.AutomaticStress.value, |
| ], |
| [ |
| "Привіт, як тебе звати?", |
| VoiceOption.FemaleVoice.value, |
| StressOption.AutomaticStress.value, |
| ], |
| [ |
| "Договір підписано 4 квітня 1949 року.", |
| VoiceOption.FemaleVoice.value, |
| StressOption.AutomaticStress.value, |
| ], |
| ], |
| ) |
| iface.launch() |
|
|