Spaces:
Runtime error
Runtime error
Commit
·
502d612
1
Parent(s):
124dbfa
Update app.py
Browse files
app.py
CHANGED
@@ -174,7 +174,7 @@ def Transcribe_V2(num_speakers, speaker_names, audio="temp_audio.wav"):
|
|
174 |
# conversation.append([GetSpeaker(segment["speaker"]), segment["text"][1:]]) # segment["speaker"] + ' ' + str(time(segment["start"])) + '\n\n'
|
175 |
# conversation[-1][1] += segment["text"][1:]
|
176 |
# return output
|
177 |
-
return ("".join([f"{speaker} --> {text}\n" for speaker, text in conversation])), ({ "data": [{"speaker": speaker, "text": text} for speaker, text in conversation]})
|
178 |
|
179 |
def get_duration(path):
|
180 |
with contextlib.closing(wave.open(path,'r')) as f:
|
@@ -232,7 +232,7 @@ def AudioTranscribe(NumberOfSpeakers=None, SpeakerNames="", audio="", retries=5)
|
|
232 |
return AudioTranscribe(NumberOfSpeakers, SpeakerNames, audio, retries-1)
|
233 |
if not (os.path.isfile("temp_audio.wav")):
|
234 |
return AudioTranscribe(NumberOfSpeakers, SpeakerNames, audio, retries-1)
|
235 |
-
return
|
236 |
else:
|
237 |
raise gr.Error("There is some issue ith Audio Transcriber. Please try again later!")
|
238 |
|
@@ -248,10 +248,10 @@ def VideoTranscribe(NumberOfSpeakers=None, SpeakerNames="", video="", retries=5)
|
|
248 |
return VideoTranscribe(NumberOfSpeakers, SpeakerNames, video, retries-1)
|
249 |
if not (os.path.isfile("temp_audio.wav")):
|
250 |
return VideoTranscribe(NumberOfSpeakers, SpeakerNames, video, retries-1)
|
251 |
-
return
|
252 |
else:
|
253 |
raise gr.Error("There is some issue ith Video Transcriber. Please try again later!")
|
254 |
-
return
|
255 |
|
256 |
def YoutubeTranscribe(NumberOfSpeakers=None, SpeakerNames="", URL="", retries = 5):
|
257 |
if retries:
|
@@ -275,7 +275,7 @@ def YoutubeTranscribe(NumberOfSpeakers=None, SpeakerNames="", URL="", retries =
|
|
275 |
stream = ffmpeg.input('temp_audio.m4a')
|
276 |
stream = ffmpeg.output(stream, 'temp_audio.wav')
|
277 |
RemoveFile("temp_audio.m4a")
|
278 |
-
return
|
279 |
else:
|
280 |
raise gr.Error(f"Unable to get video from {URL}")
|
281 |
|
|
|
174 |
# conversation.append([GetSpeaker(segment["speaker"]), segment["text"][1:]]) # segment["speaker"] + ' ' + str(time(segment["start"])) + '\n\n'
|
175 |
# conversation[-1][1] += segment["text"][1:]
|
176 |
# return output
|
177 |
+
return ("".join([f"{speaker} --> {text}\n" for speaker, text in conversation])), ({ "data": [{"speaker": speaker, "text": text} for speaker, text in conversation]})
|
178 |
|
179 |
def get_duration(path):
|
180 |
with contextlib.closing(wave.open(path,'r')) as f:
|
|
|
232 |
return AudioTranscribe(NumberOfSpeakers, SpeakerNames, audio, retries-1)
|
233 |
if not (os.path.isfile("temp_audio.wav")):
|
234 |
return AudioTranscribe(NumberOfSpeakers, SpeakerNames, audio, retries-1)
|
235 |
+
return Transcribe_V1(NumberOfSpeakers, SpeakerNames)
|
236 |
else:
|
237 |
raise gr.Error("There is some issue ith Audio Transcriber. Please try again later!")
|
238 |
|
|
|
248 |
return VideoTranscribe(NumberOfSpeakers, SpeakerNames, video, retries-1)
|
249 |
if not (os.path.isfile("temp_audio.wav")):
|
250 |
return VideoTranscribe(NumberOfSpeakers, SpeakerNames, video, retries-1)
|
251 |
+
return Transcribe_V1(NumberOfSpeakers, SpeakerNames)
|
252 |
else:
|
253 |
raise gr.Error("There is some issue ith Video Transcriber. Please try again later!")
|
254 |
+
return Transcribe_V1(NumberOfSpeakers, SpeakerNames)
|
255 |
|
256 |
def YoutubeTranscribe(NumberOfSpeakers=None, SpeakerNames="", URL="", retries = 5):
|
257 |
if retries:
|
|
|
275 |
stream = ffmpeg.input('temp_audio.m4a')
|
276 |
stream = ffmpeg.output(stream, 'temp_audio.wav')
|
277 |
RemoveFile("temp_audio.m4a")
|
278 |
+
return Transcribe_V1(NumberOfSpeakers, SpeakerNames)
|
279 |
else:
|
280 |
raise gr.Error(f"Unable to get video from {URL}")
|
281 |
|