Update modules/whisper/whisper_base.py
Browse files250 unmodified lines2512522532542552562572 unmodified lines2602612622632642652662672682692 unmodified lines2722732742752762772782792 unmodified lines282283284285286287288289290291292293294295250 unmodified lines## files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language}## Add 1st file as txtfile_name, file_ext = os.path.splitext(os.path.basename(file))subtitle, file_path = self.generate_and_write_file(file_name=file_name,2 unmodified linesfile_format="txt",output_dir=self.output_dir)files_info["txt_file"] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language}## Add 2nd file as srtfile_name, file_ext = os.path.splitext(os.path.basename(file))subtitle, file_path = self.generate_and_write_file(file_name=file_name,2 unmodified linesfile_format="srt",output_dir=self.output_dir)files_info["srt_file"] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language}total_result = ''total_info = ''2 unmodified linestotal_result += f'{info["subtitle"]}'total_time += info["time_for_task"]#total_info += f'{info["lang"]}'total_info += f"Language {info['lang']} detected for file '{file_name}{file_ext}'"#result_str = f"Processing of file '{file_name}{file_ext}' done in {self.format_time(total_time)}:\n\n{total_result}"total_info += f"\nTranscription process done in {self.format_time(total_time)}"result_str = total_resultresult_file_path = [info['path'] for info in files_info.values()]total_info +=str(len(files_info))return [result_str, result_file_path, total_info]except Exception as e:250 unmodified lines2512522532542552562572 unmodified lines2602612622632642652662672682 unmodified lines2712722732742752762772782792 unmodified lines282283284285286287288289290291292293294295250 unmodified lines## files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language}## Add output file as txtfile_name, file_ext = os.path.splitext(os.path.basename(file))subtitle, file_path = self.generate_and_write_file(file_name=file_name,2 unmodified linesfile_format="txt",output_dir=self.output_dir)files_info[file_name+"_txt"] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language}## Add output file as srtfile_name, file_ext = os.path.splitext(os.path.basename(file))subtitle, file_path = self.generate_and_write_file(file_name=file_name,2 unmodified linesfile_format="srt",output_dir=self.output_dir)files_info[file_name+"_srt"] = {"subtitle": subtitle, "time_for_task": time_for_task, "path": file_path, "lang": file_language}break ## Processing of 1 linetotal_result = ''total_info = ''2 unmodified linestotal_result += f'{info["subtitle"]}'total_time += info["time_for_task"]#total_info += f'{info["lang"]}'total_info += f"Language {info['lang']} detected for file '{file_name}{file_ext}'"break ## Processing of 1 line#result_str = f"Processing of file '{file_name}{file_ext}' done in {self.format_time(total_time)}:\n\n{total_result}"total_info += f"\nTranscription process done in {self.format_time(total_time)}"result_str = total_resultresult_file_path = [info['path'] for info in files_info.values()]return [result_str, result_file_path, total_info]except Exception as e:
modules/whisper/whisper_base.py+8-8