
    mi                     &    d dl Z d dlZd dlmZ d Zy)    N)HTTPExceptionc                 F  K   |t        dd      dt        j                          d| j                   }	 t	        |d      5 }|j                  | j                          d {          d d d        |j                  |dddd 	      \  }}d
j                  |D cg c]  }|j                   c}      }d
j                  |j                               }||j                  t        |j                  d      dt        j                  j!                  |      rt        j"                  |       S S 7 # 1 sw Y   xY wc c}w # t$        $ r}	t        dt'        |	            d }	~	ww xY w# t        j                  j!                  |      rt        j"                  |       w w xY ww)Ni  z5Model is still loading, please try again in a moment.)status_codedetailtemp__wb
   T)	beam_sizebest_of
vad_filterlanguage    )textdetected_languagelanguage_probabilityi  )r   uuiduuid4filenameopenwriteread
transcribejoinr   splitr   roundr   ospathexistsremove	Exceptionstr)
filemodelfile_locationfsegmentsinfosegmentr   
clean_textes
             :/var/www/html/speakWrite/services/transcription_service.pytranscription_servicer.      sh    }J
 	

 DJJL>4==/:M%-& 	'!GG$))+%&	'
 )) * 
$ xxX>'>?XXdjjl+
 !%$)$*C*CQ$G
 77>>-(IIm$ )5 &	' 	' ?  <CF;;< 77>>-(IIm$ )sk   4F!E  D/"D-
#D/+0E  D;.A	E  76F!-D//D84E   	E$	EE$$E' '7FF!)r   r   fastapir   r.        r-   <module>r2      s    	  !'%r1   