Ë
    @h^  ã                   ó¨   — d dl mZmZmZ d dlmZ d dlmZ d dlZd dl	Z	 e«       Z
 G d„ de«      Ze
j                  d«       ed«      fd	efd
„«       Zy)é    )Ú	APIRouterÚBodyÚHTTPException)Ú	BaseModel)ÚtexttospeechNc                   ó&   — e Zd ZU eed<   dZeed<   y)ÚTTSInputÚtextÚenÚlanguageN)Ú__name__Ú
__module__Ú__qualname__ÚstrÚ__annotations__r   © ó    úDC:\Users\aadil\OneDrive\Desktop\404\backend\app\api\endpoints\tts.pyr	   r	   	   s   … Ø
ƒIØ€HˆcÔr   r	   z/tts.Ú	tts_inputc              ƒ   ó  K  — 	 t        j                  «       }t        j                  | j                  ¬«      }t        j                  | j
                  t         j                  j                  ¬«      }t        j                  t         j                  j                  ¬«      }|j                  |||¬«      }dt        j                  «       › d�}t        j                  j!                  dd|«      }t        j"                  t        j                  j%                  |«      d	¬
«       t'        |d«      5 }|j)                  |j*                  «       d d d «       d|› �}	d|	iS # 1 sw Y   ŒxY w# t,        $ r}
t/        dt1        |
«      ¬«      ‚d }
~
ww xY w­w)N)r
   )Úlanguage_codeÚssml_gender)Úaudio_encoding)ÚinputÚvoiceÚaudio_configÚtts_z.mp3ÚstaticÚ	tts_audioT)Úexist_okÚwbz/static/tts_audio/Ú	audio_urliô  )Ústatus_codeÚdetail)r   ÚTextToSpeechClientÚSynthesisInputr
   ÚVoiceSelectionParamsr   ÚSsmlVoiceGenderÚNEUTRALÚAudioConfigÚAudioEncodingÚMP3Úsynthesize_speechÚuuidÚuuid4ÚosÚpathÚjoinÚmakedirsÚdirnameÚopenÚwriteÚaudio_contentÚ	Exceptionr   r   )r   ÚclientÚsynthesis_inputr   r   ÚresponseÚfilenameÚ
audio_pathÚoutr"   Úes              r   Úttsr@      s?  è ø€ ð<Ü×0Ñ0Ó2ˆÜ&×5Ñ5¸9¿>¹>ÔJˆä×1Ñ1Ø#×,Ñ,Ü$×4Ñ4×<Ñ<ô
ˆô $×/Ñ/Ü'×5Ñ5×9Ñ9ô
ˆð ×+Ñ+Ø!¨¸\ð ,ó 
ˆð œ$Ÿ*™*›,˜ tÐ,ˆÜ—W‘W—\‘\ (¨K¸ÓBˆ
Ü
�‰”B—G‘G—O‘O JÓ/¸$Õ?Ü�*˜dÔ# sØ�I‰I�h×,Ñ,Ô-÷ $à(¨¨
Ð3ˆ	Ø˜YÐ'Ð'÷ $Ð#ûô ò <Ü¨´C¸³FÔ;Ð;ûð<üsA   ‚F„D(E% Ä,EÅE% ÅFÅE"ÅE% Å%	F	Å.FÆF	Æ	F)Úfastapir   r   r   Úpydanticr   Úgoogle.cloudr   r.   r0   Úrouterr	   Úpostr@   r   r   r   Ú<module>rF      sU   ðß 2Ñ 2Ý Ý %Û Û 	á	‹€ôˆyô ð ‡�ˆVÓÙ$(¨£Iñ <˜ò <ó ñ<r   