Skip to content

Commit

Permalink
python
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed Aug 19, 2024
1 parent 419e833 commit 7a3b80c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/deep_phonemizer/dp_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def forward(self, text, phonemes=None, start_index=None):
metadata = {
"languages": "de en_us",
"text_symbols": "a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ä ö ü Ä Ö Ü ß",
"phoneme_symbols": "a b d e f g h i j k l m n o p r s t u v w x y z æ ç ð ø ŋ œ ɐ ɑ ɔ ə ɛ ɜ ɹ ɡ ɪ ʁ ʃ ʊ ʌ ʏ ʒ ʔ ' ˌ ː ̃ ̍ ̥ ̩ ̯ ͡ θ . , : ; ? !",
"phoneme_symbols": "a b d e f g h i j k l m n o p r s t u v w x y z æ ç ð ø ŋ œ ɐ ɑ ɔ ə ɛ ɜ ɹ ɡ ɪ ʁ ʃ ʊ ʌ ʏ ʒ ʔ ' ˌ ː ̃ ̍ ̥ ̩ ̯ ͡ θ . , : ; ? ! \" ( ) -",
"char_repeats": "3" if isinstance(model, ForwardTransformer) else "1",
"lowercase": "1"
}
Expand Down
14 changes: 9 additions & 5 deletions wrappers/babylon.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import ctypes
import os

current_dir = os.path.dirname(os.path.abspath(__file__))

symbols = " abdefghijklmnoprstuvwxyzæçðøŋœɐɑɔəɛɜɹɡɪʁʃʊʌʏʒʔ'ˌː ̃ ̍ ̥ ̩ ̯ ͡θ.,:;?!\"()-"

# Load the shared library
if os.name == 'nt': # Windows
babylon_lib = ctypes.CDLL('./windows/libbabylon.dll')
babylon_lib = ctypes.CDLL(os.path.join(current_dir, 'windows', 'libbabylon.dll'))
elif os.name == 'posix': # macOS
babylon_lib = ctypes.CDLL('./macos/libbabylon.dylib')
babylon_lib = ctypes.CDLL(os.path.join(current_dir, 'macos', 'libbabylon.dylib'))
else: # Linux/Unix
babylon_lib = ctypes.CDLL('./linux/libbabylon.so')
babylon_lib = ctypes.CDLL(os.path.join(current_dir, 'linux', 'libbabylon.so'))

# Define the function prototypes
babylon_lib.babylon_g2p_init.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int]
Expand Down Expand Up @@ -71,8 +75,8 @@ def free_tts():

# Example usage
if __name__ == '__main__':
g2p_model_path = './models/deep_phonemizer.onnx'
tts_model_path = './models/curie.onnx'
g2p_model_path = os.path.join(current_dir, "models", "deep_phonemizer.onnx")
tts_model_path = os.path.join(current_dir, "models", "curie.onnx")
language = 'en_us'
use_punctuation = 1
sequence = 'Hello world, This is a python test of babylon'
Expand Down

0 comments on commit 7a3b80c

Please sign in to comment.