Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -239,7 +239,7 @@ def transcription(stt_tokenizer, stt_model, summarizer, dia_pipeline, filename,
|
|
239 |
if filename.endswith((".mp3", ".mp4")):
|
240 |
myaudio, filename = convert_file_to_wav(myaudio, filename)
|
241 |
else:
|
242 |
-
filename = "
|
243 |
myaudio.export(filename, format="wav")
|
244 |
|
245 |
# Differentiate speakers process
|
@@ -259,7 +259,7 @@ def transcription(stt_tokenizer, stt_model, summarizer, dia_pipeline, filename,
|
|
259 |
if timestamps_token:
|
260 |
update_session_state("chosen mode", "NODIA_TS")
|
261 |
|
262 |
-
filename = "
|
263 |
# Transcribe process with non Diarization Mode
|
264 |
save_result, txt_text, srt_text = transcription_non_diarization(filename, myaudio, start, end, diarization_token, timestamps_token, srt_token, summarize_token, stt_model, stt_tokenizer, min_space, max_space, save_result, txt_text, srt_text)
|
265 |
|
@@ -280,7 +280,7 @@ def transcription(stt_tokenizer, stt_model, summarizer, dia_pipeline, filename,
|
|
280 |
txt_text += my_split_text
|
281 |
|
282 |
# Delete files
|
283 |
-
clean_directory("
|
284 |
|
285 |
# Display the final transcript
|
286 |
if txt_text != "":
|
@@ -820,7 +820,7 @@ def convert_file_to_wav(aud_seg, filename):
|
|
820 |
:param filename: name of the file
|
821 |
:return: name of the converted file
|
822 |
"""
|
823 |
-
filename = "
|
824 |
aud_seg.export(filename, format="wav")
|
825 |
|
826 |
newaudio = AudioSegment.from_file(filename)
|
|
|
239 |
if filename.endswith((".mp3", ".mp4")):
|
240 |
myaudio, filename = convert_file_to_wav(myaudio, filename)
|
241 |
else:
|
242 |
+
filename = "whisper_app/data/" + filename
|
243 |
myaudio.export(filename, format="wav")
|
244 |
|
245 |
# Differentiate speakers process
|
|
|
259 |
if timestamps_token:
|
260 |
update_session_state("chosen mode", "NODIA_TS")
|
261 |
|
262 |
+
filename = "whisper_app/data/" + filename
|
263 |
# Transcribe process with non Diarization Mode
|
264 |
save_result, txt_text, srt_text = transcription_non_diarization(filename, myaudio, start, end, diarization_token, timestamps_token, srt_token, summarize_token, stt_model, stt_tokenizer, min_space, max_space, save_result, txt_text, srt_text)
|
265 |
|
|
|
280 |
txt_text += my_split_text
|
281 |
|
282 |
# Delete files
|
283 |
+
clean_directory("whisper_app/data") # clean folder that contains generated files
|
284 |
|
285 |
# Display the final transcript
|
286 |
if txt_text != "":
|
|
|
820 |
:param filename: name of the file
|
821 |
:return: name of the converted file
|
822 |
"""
|
823 |
+
filename = "whisper_app/data/my_wav_file_" + filename[:-3] + "wav"
|
824 |
aud_seg.export(filename, format="wav")
|
825 |
|
826 |
newaudio = AudioSegment.from_file(filename)
|