Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -259,16 +259,6 @@ class WhisperBase(ABC):
|
|
| 259 |
*whisper_params,
|
| 260 |
)
|
| 261 |
|
| 262 |
-
#file_name, file_ext = os.path.splitext(os.path.basename(file))
|
| 263 |
-
#subtitle, file_path = self.generate_and_write_file(
|
| 264 |
-
# file_name=file_name,
|
| 265 |
-
# transcribed_segments=transcribed_segments,
|
| 266 |
-
# add_timestamp=add_timestamp,
|
| 267 |
-
# file_format=file_format,
|
| 268 |
-
# output_dir=self.output_dir
|
| 269 |
-
#)
|
| 270 |
-
#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)}
|
| 271 |
-
|
| 272 |
# Define source language
|
| 273 |
source_lang = file_language
|
| 274 |
|
|
@@ -293,7 +283,7 @@ class WhisperBase(ABC):
|
|
| 293 |
if source_lang != target_lang:
|
| 294 |
translation_note = source_lang + " to " + target_lang
|
| 295 |
else:
|
| 296 |
-
translation_note =
|
| 297 |
else:
|
| 298 |
translation_note = source_lang + " not supported"
|
| 299 |
|
|
@@ -341,7 +331,7 @@ class WhisperBase(ABC):
|
|
| 341 |
for file_name, info in files_info.items():
|
| 342 |
total_result += f'{info["subtitle"]}'
|
| 343 |
total_time += info["time_for_task"]
|
| 344 |
-
total_info += f'Input file: {info["input_source_file"]}\nLanguage: {info["lang"]}
|
| 345 |
|
| 346 |
if params.is_translate:
|
| 347 |
total_info += f'Transcription: {info["transcription"]}\n'
|
|
|
|
| 259 |
*whisper_params,
|
| 260 |
)
|
| 261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
# Define source language
|
| 263 |
source_lang = file_language
|
| 264 |
|
|
|
|
| 283 |
if source_lang != target_lang:
|
| 284 |
translation_note = source_lang + " to " + target_lang
|
| 285 |
else:
|
| 286 |
+
translation_note = "Source & target languages are " + target_lang
|
| 287 |
else:
|
| 288 |
translation_note = source_lang + " not supported"
|
| 289 |
|
|
|
|
| 331 |
for file_name, info in files_info.items():
|
| 332 |
total_result += f'{info["subtitle"]}'
|
| 333 |
total_time += info["time_for_task"]
|
| 334 |
+
total_info += f'Input file: {info["input_source_file"]}\nLanguage: {info["lang"]} (probability {info["lang_prob"]}%)\n'
|
| 335 |
|
| 336 |
if params.is_translate:
|
| 337 |
total_info += f'Transcription: {info["transcription"]}\n'
|