Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
import whisper
|
3 |
-
from pytube import YouTube
|
4 |
-
|
5 |
-
|
6 |
|
7 |
loaded_model = whisper.load_model("medium")
|
8 |
current_size = 'medium'
|
9 |
|
10 |
-
|
11 |
-
from pytube. innertube import _default_clients
|
12 |
-
|
13 |
-
_default_clients[ "ANDROID"][ "context"]["client"]["clientVersion"] = "19.08.35"
|
14 |
-
_default_clients["IOS"]["context"]["client"]["clientVersion"] = "19.08.35"
|
15 |
-
_default_clients[ "ANDROID_EMBED"][ "context"][ "client"]["clientVersion"] = "19.08.35"
|
16 |
-
_default_clients[ "IOS_EMBED"][ "context"]["client"]["clientVersion"] = "19.08.35"
|
17 |
-
_default_clients["IOS_MUSIC"][ "context"]["client"]["clientVersion"] = "6.41"
|
18 |
-
_default_clients[ "ANDROID_MUSIC"] = _default_clients[ "ANDROID_CREATOR" ]
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
def inference(link):
|
24 |
-
yt = YouTube(link)
|
25 |
#yt = YouTube(link, on_progress_callback=on_progress, use_po_token=True)
|
26 |
-
|
27 |
-
audio_stream
|
28 |
-
|
|
|
29 |
#path = yt.streams.get_audio_only().download(mp3=True)
|
|
|
30 |
options = whisper.DecodingOptions(language= 'Spanish', without_timestamps=True)
|
31 |
results = loaded_model.transcribe(path)
|
32 |
return results['text']
|
|
|
1 |
import gradio as gr
|
2 |
import whisper
|
3 |
+
#from pytube import YouTube
|
4 |
+
from pytubefix import YouTube
|
5 |
+
from pytubefix.cli import on_progress
|
6 |
|
7 |
loaded_model = whisper.load_model("medium")
|
8 |
current_size = 'medium'
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
def inference(link):
|
11 |
+
#yt = YouTube(link)
|
12 |
#yt = YouTube(link, on_progress_callback=on_progress, use_po_token=True)
|
13 |
+
yt = YouTube(link, on_progress_callback=on_progress)
|
14 |
+
#global audio_stream
|
15 |
+
#audio_stream = yt.streams.filter(only_audio=True, file_extension='mp4').first()
|
16 |
+
#path = audio_stream.download()
|
17 |
#path = yt.streams.get_audio_only().download(mp3=True)
|
18 |
+
path = yt.streams.get_audio_only().download()
|
19 |
options = whisper.DecodingOptions(language= 'Spanish', without_timestamps=True)
|
20 |
results = loaded_model.transcribe(path)
|
21 |
return results['text']
|