Skip to content

Commit

Permalink
Release 6.0.0 model
Browse files Browse the repository at this point in the history
  • Loading branch information
robinhad committed Sep 17, 2023
1 parent dc248e1 commit 316ae6b
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 162 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ dmypy.json
*.pth.tar
*.pth
*.ark
*.npz

# gradio
gradio_queue.db
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,30 @@ If you like my work, please support ❤️ -> [https://send.monobank.ua/jar/48iH
You're welcome to join UA Speech Recognition and Synthesis community: [Telegram https://t.me/speech_recognition_uk](https://t.me/speech_recognition_uk)
# Examples 🤖

`Tetiana (female)`:
`Oleksa (male)`:

https://user-images.githubusercontent.com/5759207/224504324-d8236cad-7302-4dfd-9696-7a42b9f05fce.mp4
https://github.com/robinhad/ukrainian-tts/assets/5759207/ace842ef-06d0-4b1f-ad49-5fda92999dbb


<details>
<summary>More voices 📢🤖</summary>

`Dmytro (male)`:
`Tetiana (female)`:

https://user-images.githubusercontent.com/5759207/224504354-f84f74d3-fa46-497c-9604-4b63ba45989f.mp4
https://github.com/robinhad/ukrainian-tts/assets/5759207/a6ecacf6-62ae-4fc5-b6d5-41e6cdd3d992

`Dmytro (male)`:

`Lada (female)`:
https://github.com/robinhad/ukrainian-tts/assets/5759207/67d3dac9-6626-40ef-98e5-ec194096bbe0

https://user-images.githubusercontent.com/5759207/224504360-ec198ac2-647c-4238-99ef-b6f074d633fd.mp4
`Lada (female)`:

https://github.com/robinhad/ukrainian-tts/assets/5759207/fcf558b2-3ff9-4539-ad9e-8455b52223a4

`Mykyta (male)`:

https://user-images.githubusercontent.com/5759207/224504363-0227e8bf-8c1c-49ad-8602-8cbf8feaa82b.mp4
https://github.com/robinhad/ukrainian-tts/assets/5759207/033f5215-3f09-4021-ba19-1f55158445ca


</details>

Expand Down
23 changes: 6 additions & 17 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class VoiceOption(Enum):
Mykyta = "Микита (чоловічий) 👨"
Lada = "Лада (жіночий) 👩"
Dmytro = "Дмитро (чоловічий) 👨"
Oleksa = "Олекса (чоловічий) 👨"


print(f"CUDA available? {is_available()}")
Expand All @@ -51,7 +52,7 @@ class VoiceOption(Enum):
ukr_tts = TTS(device="cuda" if is_available() else "cpu")


def tts(text: str, voice: str, speed: float):
def tts(text: str, voice: str):
print("============================")
print("Original text:", text)
print("Voice", voice)
Expand All @@ -62,6 +63,7 @@ def tts(text: str, voice: str, speed: float):
VoiceOption.Mykyta.value: Voices.Mykyta.value,
VoiceOption.Lada.value: Voices.Lada.value,
VoiceOption.Dmytro.value: Voices.Dmytro.value,
VoiceOption.Oleksa.value: Voices.Oleksa.value,
}

speaker_name = voice_mapping[voice]
Expand All @@ -72,11 +74,11 @@ def tts(text: str, voice: str, speed: float):

if getenv("HF_API_TOKEN") is not None:
log_queue.put(
[text, speaker_name, Stress.Dictionary.value, speed, str(datetime.utcnow())]
[text, speaker_name, Stress.Dictionary.value, 1, str(datetime.utcnow())]
)

with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
_, text = ukr_tts.tts(text, speaker_name, Stress.Dictionary.value, fp, speed)
_, text = ukr_tts.tts(text, speaker_name, Stress.Dictionary.value, fp)
return fp.name, text


Expand All @@ -97,9 +99,6 @@ def tts(text: str, voice: str, speed: float):
choices=[option.value for option in VoiceOption],
value=VoiceOption.Tetiana.value,
),
gr.components.Slider(
label="Швидкість", minimum=0.5, maximum=2, value=1, step=0.05
),
],
outputs=[
gr.components.Audio(label="Output"),
Expand All @@ -112,32 +111,22 @@ def tts(text: str, voice: str, speed: float):
[
"Привіт, як тебе звати?",
VoiceOption.Tetiana.value,
1,
],
[
"Введіть, будь ласка, св+оє реч+ення.",
VoiceOption.Dmytro.value,
1,
],
[
"Введіть, будь ласка, своє речення.",
VoiceOption.Dmytro.value,
1.3,
],
[
"Введіть, будь ласка, своє речення.",
VoiceOption.Mykyta.value,
1,
VoiceOption.Oleksa.value,
],
[
"Введіть, будь ласка, своє речення.",
VoiceOption.Mykyta.value,
0.7,
],
[
"Договір підписано 4 квітня 1949 року.",
VoiceOption.Lada.value,
0.9,
],
],
)
Expand Down
Loading

0 comments on commit 316ae6b

Please sign in to comment.