
    mi                     (    d dl Z d dlZd dlmZ d ZdS )    N)HTTPExceptionc                 P  K   |t          dd          dt          j                     d| j         }	 t	          |d          5 }|                    |                                  d {V            d d d            n# 1 swxY w Y   |                    |dddd 	          \  }}d
                    d |D                       }d
                    |	                                          }||j
        t          |j        d          dt          j                            |          rt          j        |           S S # t"          $ r#}t          dt%          |                    d }~ww xY w# t          j                            |          rt          j        |           w w xY 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 c                     g | ]	}|j         
S  )text).0segments     :/var/www/html/speakWrite/services/transcription_service.py
<listcomp>z)transcription_service.<locals>.<listcomp>   s    >>>'>>>       )r   detected_languagelanguage_probabilityi  )r   uuiduuid4filenameopenwriteread
transcribejoinsplitr   roundr   ospathexistsremove	Exceptionstr)	filemodelfile_locationfsegmentsinfor   
clean_textes	            r   transcription_servicer3      s     }J
 
 
 	

 ;DJLL::4=::M%-&& 	'!GG$))++%%%%%%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'
 )) * 
 
$ xx>>X>>>??XXdjjll++
 !%$)$*CQ$G$G
 
 7>>-(( 	%Im$$$$	%	  < < <CFF;;;;< 7>>-(( 	%Im$$$$	%sH   D? .A?3D? ?BD? BBD? ?
E,	E''E,,E/ /6F%)r%   r   fastapir   r3   r   r   r   <module>r5      sB    				  ! ! ! ! ! !'% '% '% '% '%r   