@@ -25,7 +25,6 @@ def __init__(self, funasr_model):
2525 logging .warning ("Initializing VideoClipper." )
2626 self .funasr_model = funasr_model
2727 self .GLOBAL_COUNT = 0
28- self .lang = "zh"
2928
3029 def recog (self , audio_input , sd_switch = 'no' , state = None , hotwords = "" , output_dir = None ):
3130 if state is None :
@@ -243,7 +242,7 @@ def video_clip(self,
243242 chi_subs .append (((sub [0 ][0 ]- sub_starts , sub [0 ][1 ]- sub_starts ), sub [1 ]))
244243 start , end = start + start_ost / 1000.0 , end + end_ost / 1000.0
245244 _video_clip = video .subclip (start , end )
246- start_end_info += ", from {} to {}" .format (start , end )
245+ start_end_info += ", from {} to {}" .format (str ( start )[: 5 ], str ( end )[: 5 ] )
247246 clip_srt += srt_clip
248247 if add_sub :
249248 generator = lambda txt : TextClip (txt , font = './font/STHeitiMedium.ttc' , fontsize = font_size , color = font_color )
@@ -341,13 +340,13 @@ def get_parser():
341340 parser .add_argument (
342341 "--lang" ,
343342 type = str ,
344- default = "zh" ,
345- help = "Language choice "
343+ default = 'zh' ,
344+ help = "language "
346345 )
347346 return parser
348347
349348
350- def runner (stage , file , sd_switch , output_dir , dest_text , dest_spk , start_ost , end_ost , output_file , lang = "zh" , config = None ):
349+ def runner (stage , file , sd_switch , output_dir , dest_text , dest_spk , start_ost , end_ost , output_file , config = None , lang = 'zh' ):
351350 audio_suffixs = ['.wav' ,'.mp3' ,'.aac' ,'.m4a' ,'.flac' ]
352351 video_suffixs = ['.mp4' ,'.avi' ,'.mkv' ,'.flv' ,'.mov' ,'.webm' ,'.ts' ,'.mpeg' ]
353352 _ ,ext = os .path .splitext (file )
@@ -366,7 +365,7 @@ def runner(stage, file, sd_switch, output_dir, dest_text, dest_spk, start_ost, e
366365 from funasr import AutoModel
367366 # initialize funasr automodel
368367 logging .warning ("Initializing modelscope asr pipeline." )
369- if lang == "zh" :
368+ if lang == 'zh' :
370369 funasr_model = AutoModel (model = "iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch" ,
371370 vad_model = "damo/speech_fsmn_vad_zh-cn-16k-common-pytorch" ,
372371 punc_model = "damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch" ,
@@ -439,4 +438,4 @@ def main(cmd=None):
439438
440439
441440if __name__ == '__main__' :
442- main ()
441+ main ()
0 commit comments