o
    [h                     @   s"  d dl Z d dlZd dlmZ d dlZd dlmZ d dlmZ edddZ	i Z
i Zi Zi Zi Zi Zi Zi Zi Zej Ze Zej rEdnd	Zd
d edD Zdd edD Ze  Ze  ZeeeD ]Ze e qgeeeD ]Ze e qudZ!dd Z"dd Z#dd Z$dd Z%dS )    N)TTS)SocketIO)get_mongo_client*eventlet)Zcors_allowed_originsZ
async_modecudacpuc                 C   s   g | ]}t d ddtqS )z!tts_models/en/ljspeech/fast_pitchF)Z
model_nameZprogress_bar)r   todevice.0_ r   -/var/www/html/aiverses.in/BackEnd/app/core.py
<listcomp>   s    r      c                 C   s   g | ]
}t d tqS )base)whisperZ
load_modelr	   r
   r   r   r   r   r      s    i   c                   C      t jddS NT)block)	tts_queuegetr   r   r   r   get_available_tts#       r   c                   C   r   r   )	stt_queuer   r   r   r   r   get_available_stt$   r   r   c                 C      t |  d S N)r   putidxr   r   r   release_tts%       r"   c                 C   r   r   )r   r   r    r   r   r   release_stt&   r#   r$   )&queueZtorchZTTS.apir   r   Zflask_socketior   Zapp.database.fetch_datar   socketioZaudio_buffersZcharacterIdsZ
sectionIdsZlast_ping_timeZbuttonsStatesZcharacter_actionsZdistance_objectsZaction_modesmetadatar   is_availableZuse_gpuclientr
   rangeZTTS_INSTANCESZSTT_INSTANCESQueuer   r   lenir   Z
CHUNK_SIZEr   r   r"   r$   r   r   r   r   <module>   s:    
