Bagda commited on
Commit
6480da6
·
verified ·
1 Parent(s): 8162cb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -17,21 +17,21 @@ demo = gr.Interface(
17
 
18
  demo.launch()
19
 
 
20
  from pytube import YouTube
21
 
22
- # YouTube video ki link yahan daalein
23
  video_url = "https://www.youtube.com/watch?v=YOUR_VIDEO_ID"
24
-
25
- # YouTube object banayein
26
  yt = YouTube(video_url)
 
 
 
 
27
 
28
- # Highest resolution wali stream select karein
29
- stream = yt.streams.get_highest_resolution()
 
30
 
31
- # Video download karein (default folder mein)
32
- stream.download()
33
 
34
- print("Video download ho gaya:", yt.title)
35
 
36
  from transformers import WhisperProcessor, WhisperForConditionalGeneration
37
  import torch
 
17
 
18
  demo.launch()
19
 
20
+
21
  from pytube import YouTube
22
 
 
23
  video_url = "https://www.youtube.com/watch?v=YOUR_VIDEO_ID"
 
 
24
  yt = YouTube(video_url)
25
+ stream = yt.streams.filter(only_audio=True).first()
26
+ stream.download(filename="video_audio.mp4")
27
+
28
+ from moviepy.editor import VideoFileClip
29
 
30
+ video = VideoFileClip("video_audio.mp4")
31
+ audio = video.audio
32
+ audio.write_audiofile("output_audio.wav")
33
 
 
 
34
 
 
35
 
36
  from transformers import WhisperProcessor, WhisperForConditionalGeneration
37
  import torch