o
    mi                     @   sZ   d dl Z d dlmZ d dlmZ dZdZeG dd dZG dd	 d	Zd
d Z	e	 Z
dS )    N)	dataclass)Pathi  i]  c                   @   s.   e Zd ZU dZedB ed< dZedB ed< dS )EspeakConfigNlib_path	data_path)__name__
__module____qualname__r   str__annotations__r    r   r   L/home/kim/smarthome/.venv/lib/python3.10/site-packages/kokoro_onnx/config.pyr   	   s   
 r   c                   @   s2   e Zd Z	d	dedededB fddZdd ZdS )
KoKoroConfigN
model_pathvoices_pathespeak_configc                 C   s   || _ || _|| _d S N)r   r   r   )selfr   r   r   r   r   r   __init__   s   
zKoKoroConfig.__init__c                 C   s`   t | j sd| j }|d7 }|d7 }t|t | j s.d| j }|d7 }t|d S )NzVoices file not found at z>
You can download the voices file using the following command:zd
wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.binzModel file not found at zZ
You can download the model file from https://github.com/thewh1teagle/kokoro-onnx/releases)r   r   existsFileNotFoundErrorr   )r   	error_msgr   r   r   validate   s   zKoKoroConfig.validater   )r   r   r	   r
   r   r   r   r   r   r   r   r      s    

r   c                  C   sL   t ttjd dd} t| }|d W  d    S 1 sw   Y  d S )Nzconfig.jsonzutf-8)encodingZvocab)openr   __file__parentjsonload)fpconfigr   r   r   	get_vocab)   s   
$r!   )r   dataclassesr   pathlibr   ZMAX_PHONEME_LENGTHZSAMPLE_RATEr   r   r!   ZDEFAULT_VOCABr   r   r   r   <module>   s    
