Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -19,6 +19,8 @@ from modules.utils.files_manager import get_media_files, format_gradio_files, lo
|
|
| 19 |
from modules.whisper.whisper_parameter import *
|
| 20 |
from modules.diarize.diarizer import Diarizer
|
| 21 |
from modules.vad.silero_vad import SileroVAD
|
|
|
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
class WhisperBase(ABC):
|
|
@@ -258,6 +260,16 @@ class WhisperBase(ABC):
|
|
| 258 |
#)
|
| 259 |
#files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language, "lang_prob": file_lang_probs, "input_source_file": (file_name+file_ext)}
|
| 260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
## Get preview as txt
|
| 262 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
| 263 |
subtitle = get_txt(transcribed_segments)
|
|
|
|
| 19 |
from modules.whisper.whisper_parameter import *
|
| 20 |
from modules.diarize.diarizer import Diarizer
|
| 21 |
from modules.vad.silero_vad import SileroVAD
|
| 22 |
+
from modules.translation.translation_base import *
|
| 23 |
+
|
| 24 |
|
| 25 |
|
| 26 |
class WhisperBase(ABC):
|
|
|
|
| 260 |
#)
|
| 261 |
#files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language, "lang_prob": file_lang_probs, "input_source_file": (file_name+file_ext)}
|
| 262 |
|
| 263 |
+
|
| 264 |
+
# Translate the trandscribed segments
|
| 265 |
+
translate_input = ""
|
| 266 |
+
for item in transcribed_segments:
|
| 267 |
+
translate_input += item['text'] + "\n"
|
| 268 |
+
|
| 269 |
+
translate_input = translate_input.rstrip()
|
| 270 |
+
translated_text = self.translate(translate_input)
|
| 271 |
+
print(translated_text)
|
| 272 |
+
|
| 273 |
## Get preview as txt
|
| 274 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
| 275 |
subtitle = get_txt(transcribed_segments)
|