SteveDigital
commited on
Commit
•
3cad30a
1
Parent(s):
d35bbff
Update app.py
Browse files
app.py
CHANGED
@@ -31,19 +31,19 @@ def get_text(url):
|
|
31 |
output_text_transcribe = ''
|
32 |
|
33 |
yt = YouTube(url)
|
34 |
-
video_length = yt.length
|
35 |
-
if video_length < 5400:
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
else:
|
46 |
-
|
47 |
#finally:
|
48 |
#raise gr.Error("Exception: There was a problem transcribing the audio after successfully retrieving it from the video/URL.")
|
49 |
|
|
|
31 |
output_text_transcribe = ''
|
32 |
|
33 |
yt = YouTube(url)
|
34 |
+
#video_length = yt.length
|
35 |
+
#if video_length < 5400:
|
36 |
+
video = yt.streams.filter(only_audio=True).first()
|
37 |
+
out_file=video.download(output_path=".")
|
38 |
+
base, ext = os.path.splitext(out_file)
|
39 |
+
new_file = base+'.mp3'
|
40 |
+
os.rename(out_file, new_file)
|
41 |
+
a = new_file
|
42 |
+
|
43 |
+
result = model.transcribe(a)
|
44 |
+
return result['text'].strip()
|
45 |
+
#else:
|
46 |
+
# return "Videos for transcription on this space are limited to 1.5 hours. Sorry about this limit but some joker thought they could stop this tool from working by transcribing many extremely long videos. Please visit https://steve.digital to contact me about this space."
|
47 |
#finally:
|
48 |
#raise gr.Error("Exception: There was a problem transcribing the audio after successfully retrieving it from the video/URL.")
|
49 |
|