Update modules/whisper/whisper_base.py
Browse files268 unmodified lines26927027127227327413 unmodified lines28828929029129229329435 unmodified lines330331332333334335268 unmodified lines#)#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)}# Translate the transcribed segmentstranslation_note = ""if translate_output:13 unmodified lines## Get preview as txtfile_name, file_ext = os.path.splitext(os.path.basename(file))subtitle = get_txt(transcribed_segments)files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "lang": file_language, "lang_prob": file_lang_probs, "input_source_file": (file_name+file_ext), "translation": translation_note}## Add output file as txtfile_name, file_ext = os.path.splitext(os.path.basename(file))35 unmodified linestotal_result += f'{info["subtitle"]}'total_time += info["time_for_task"]total_info += f'Input file: {info["input_source_file"]}\nLanguage: {info["lang"]} with probability {info["lang_prob"]}%\n'if translate_output:total_info += f'Translation: {info["translation"]}\n'268 unmodified lines26927027127227327427527627727827928013 unmodified lines29429529629729829930035 unmodified lines336337338339340341342343344345268 unmodified lines#)#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)}# Translate to English using Whisper built-in functionalitytranscription_note = ""if params.is_translate:transcription_note = "Translated to English"file_language = "English"# Translate the transcribed segmentstranslation_note = ""if translate_output:13 unmodified lines## Get preview as txtfile_name, file_ext = os.path.splitext(os.path.basename(file))subtitle = get_txt(transcribed_segments)files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "lang": file_language, "lang_prob": file_lang_probs, "input_source_file": (file_name+file_ext), "translation": translation_note, "transcription": transcription_note}## Add output file as txtfile_name, file_ext = os.path.splitext(os.path.basename(file))35 unmodified linestotal_result += f'{info["subtitle"]}'total_time += info["time_for_task"]total_info += f'Input file: {info["input_source_file"]}\nLanguage: {info["lang"]} with probability {info["lang_prob"]}%\n'if params.is_translate:total_info += f'transcription: {info["transcription"]}\n'if translate_output:total_info += f'Translation: {info["translation"]}\n'
modules/whisper/whisper_base.py+11-1