fix transcriber to deal with video and audio (2)
Browse files- src/transcriber.py +2 -2
src/transcriber.py
CHANGED
|
@@ -43,13 +43,13 @@ def write_srt(segments, max_words_per_line, srt_path):
|
|
| 43 |
file.write(result)
|
| 44 |
return result, srt_path, " ".join(result_clean)
|
| 45 |
|
| 46 |
-
def transcriber(file_input:gr.
|
| 47 |
max_words_per_line:int,
|
| 48 |
task:str,
|
| 49 |
model_version:str):
|
| 50 |
|
| 51 |
srt_filepath = os.path.normpath(f"{video_input.split('.')[0]}.srt")
|
| 52 |
-
if
|
| 53 |
audio_input = convert_video_to_audio(file_input)
|
| 54 |
else:
|
| 55 |
audio_input = file_input
|
|
|
|
| 43 |
file.write(result)
|
| 44 |
return result, srt_path, " ".join(result_clean)
|
| 45 |
|
| 46 |
+
def transcriber(file_input:gr.File,
|
| 47 |
max_words_per_line:int,
|
| 48 |
task:str,
|
| 49 |
model_version:str):
|
| 50 |
|
| 51 |
srt_filepath = os.path.normpath(f"{video_input.split('.')[0]}.srt")
|
| 52 |
+
if file_input.file_type == "video":
|
| 53 |
audio_input = convert_video_to_audio(file_input)
|
| 54 |
else:
|
| 55 |
audio_input = file_input
|