R-Kentaren commited on
Commit
42e246d
·
verified ·
1 Parent(s): b51d214

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +25 -0
main.py CHANGED
@@ -1,5 +1,30 @@
1
  import whisper
 
 
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
 
5
  def whisper_(input_audio):
 
1
  import whisper
2
+ import yt_dlp
3
+ import gradio as gr
4
 
5
+ def yt_download(link):
6
+ if not link.strip():
7
+ gr.Info("You need to provide a download link.")
8
+ print("You need to provide a download link")
9
+ return None
10
+ ydl_opts = {
11
+ 'format': 'bestaudio',
12
+ 'outtmpl': '%(title)s',
13
+ 'nocheckcertificate': True,
14
+ 'ignoreerrors': True,
15
+ 'no_warnings': True,
16
+ 'quiet': True,
17
+ 'extractaudio': True,
18
+ 'postprocessors': [{'key': 'FFmpegExtractAudio', 'preferredcodec': 'wav'}],
19
+ 'postprocessor_args': [
20
+ '-acodec', 'pcm_f32le'
21
+ ],
22
+ }
23
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
24
+ result = ydl.extract_info(link, download=True)
25
+ download_path = ydl.prepare_filename(result, outtmpl='%(title)s.wav')
26
+
27
+ return download_path
28
 
29
 
30
  def whisper_(input_audio):