Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -228,7 +228,7 @@ class WhisperBase(ABC):
|
|
| 228 |
#model = whisper.load_model(params.model_size)
|
| 229 |
mel = whisper.log_mel_spectrogram(whisper.pad_or_trim(whisper.load_audio(file))).to(model.device)
|
| 230 |
_, probs = model.detect_language(mel)
|
| 231 |
-
file_language = "
|
| 232 |
for key,value in whisper.tokenizer.LANGUAGES.items():
|
| 233 |
if key == str(max(probs, key=probs.get)):
|
| 234 |
file_language = value.capitalize()
|
|
@@ -281,10 +281,10 @@ class WhisperBase(ABC):
|
|
| 281 |
total_result += f'{info["subtitle"]}'
|
| 282 |
total_time += info["time_for_task"]
|
| 283 |
#total_info += f'{info["lang"]}'
|
| 284 |
-
total_info += f"
|
| 285 |
|
| 286 |
#result_str = f"Processing of file '{file_name}{file_ext}' done in {self.format_time(total_time)}:\n\n{total_result}"
|
| 287 |
-
total_info += f"\nTranscription
|
| 288 |
result_str = total_result
|
| 289 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
| 290 |
|
|
|
|
| 228 |
#model = whisper.load_model(params.model_size)
|
| 229 |
mel = whisper.log_mel_spectrogram(whisper.pad_or_trim(whisper.load_audio(file))).to(model.device)
|
| 230 |
_, probs = model.detect_language(mel)
|
| 231 |
+
file_language = ""
|
| 232 |
for key,value in whisper.tokenizer.LANGUAGES.items():
|
| 233 |
if key == str(max(probs, key=probs.get)):
|
| 234 |
file_language = value.capitalize()
|
|
|
|
| 281 |
total_result += f'{info["subtitle"]}'
|
| 282 |
total_time += info["time_for_task"]
|
| 283 |
#total_info += f'{info["lang"]}'
|
| 284 |
+
total_info += f"Processed file: {file}\nLanguage prediction: {info['lang']}"
|
| 285 |
|
| 286 |
#result_str = f"Processing of file '{file_name}{file_ext}' done in {self.format_time(total_time)}:\n\n{total_result}"
|
| 287 |
+
total_info += f"\nTranscription duration: {self.format_time(total_time)}"
|
| 288 |
result_str = total_result
|
| 289 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
| 290 |
|