Skip to content

FunASR-powered video transcription, subtitle generation, and LLM-assisted clipping tool with a local Gradio UI.

bugs fix

维石6d976e4af1c2
diff --git a/funclip/utils/subtitle_utils.py b/funclip/utils/subtitle_utils.py
index 0f5ad92..98b7fc1 100644
--- a/funclip/utils/subtitle_utils.py
+++ b/funclip/utils/subtitle_utils.py
@@ -35,15 +35,16 @@ class Text2SRT():
self.start_time = time_convert(start)
self.end_time = time_convert(end)
def text(self):
- res = ""
- for word in self.token_list:
- if '\u4e00' <= word <= '\u9fff':
- res += word
- else:
- res += " " + word
- return res
- def len(self):
- return len(self.token_list)
+ if isinstance(self.token_list, str):
+ return self.token_list
+ else:
+ res = ""
+ for word in self.token_list:
+ if '\u4e00' <= word <= '\u9fff':
+ res += word
+ else:
+ res += " " + word
+ return res.lstrip()
def srt(self, acc_ost=0.0):
return "{} --> {}\n{}\n".format(
time_convert(self.start_sec+acc_ost*1000),
diff --git a/funclip/videoclipper.py b/funclip/videoclipper.py
index ef0efa5..0414a28 100644
--- a/funclip/videoclipper.py
+++ b/funclip/videoclipper.py
@@ -43,11 +43,13 @@ class VideoClipper():
state['audio_input'] = (sr, data)
if sd_switch == 'Yes':
rec_result = self.funasr_model.generate(data,
+ return_spk_res=True,
return_raw_text=True,
is_final=True,
output_dir=output_dir,
hotword=hotwords,
pred_timestamp=self.lang=='en',
+ en_post_proc=self.lang=='en',
cache={})
res_srt = generate_srt(rec_result[0]['sentence_info'])
state['sd_sentences'] = rec_result[0]['sentence_info']
@@ -60,7 +62,7 @@ class VideoClipper():
hotword=hotwords,
output_dir=output_dir,
pred_timestamp=self.lang=='en',
- en_post_proc=True,
+ en_post_proc=self.lang=='en',
cache={})
res_srt = generate_srt(rec_result[0]['sentence_info'])
state['recog_res_raw'] = rec_result[0]['raw_text']
diff --git a/requirements.txt b/requirements.txt
index 27a7a53..8e7c951 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
librosa
soundfile
scikit-learn>=1.3.2
-funasr>=1.0.25
+funasr==1.0.28
moviepy
numpy
gradio