Spaces:
Runtime error
Runtime error
Commit
·
a717b8a
1
Parent(s):
fd2477f
Update transforming/whispertransform.py
Browse files
transforming/whispertransform.py
CHANGED
@@ -30,16 +30,15 @@ class WhisperTransform(Transform):
|
|
30 |
"""Creates a new video with transcriptions created by Whisper.
|
31 |
"""
|
32 |
# Create a YouTube object
|
33 |
-
yt = YouTube(video.url)
|
34 |
-
|
35 |
-
# Get audio from video
|
36 |
try:
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
audio_file = None
|
41 |
print(f"Exception: {e}")
|
42 |
-
|
|
|
|
|
|
|
43 |
result = self.model.transcribe(audio_file,
|
44 |
without_timestamps=self.without_timestamps)
|
45 |
transcription = result["text"]
|
|
|
30 |
"""Creates a new video with transcriptions created by Whisper.
|
31 |
"""
|
32 |
# Create a YouTube object
|
|
|
|
|
|
|
33 |
try:
|
34 |
+
yt = YouTube(video.url)
|
35 |
+
except (Exception):
|
36 |
+
print ("Video not available \n")
|
|
|
37 |
print(f"Exception: {e}")
|
38 |
+
# Get audio from video
|
39 |
+
else:
|
40 |
+
audio_file = self._get_audio_from_video(yt)
|
41 |
+
|
42 |
result = self.model.transcribe(audio_file,
|
43 |
without_timestamps=self.without_timestamps)
|
44 |
transcription = result["text"]
|