Spaces:
Sleeping
Sleeping
Commit
·
21621d2
1
Parent(s):
2aea2e8
Update app.py
Browse files
app.py
CHANGED
@@ -6,20 +6,29 @@ import transformers
|
|
6 |
from transformers import pipeline
|
7 |
import torch
|
8 |
from summarizer import Summarizer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
#Download youtube video
|
11 |
def download_audio(link):
|
12 |
with yt_dlp.YoutubeDL({'extract_audio': True, 'format': 'bestaudio', 'outtmpl': 'video.mp3'}) as video:
|
13 |
-
info_dict = video.extract_info(link, download = True)
|
14 |
-
video_title = info_dict['title']
|
15 |
video.download(link)
|
16 |
-
|
|
|
|
|
|
|
|
|
17 |
|
18 |
#def portuguese_sum_pipeline(link):
|
19 |
# video_title = download_audio(link)
|
20 |
|
21 |
def english_sum_pipeline(link):
|
22 |
-
|
23 |
|
24 |
#audio-to-text
|
25 |
transcriptor = whisper.load_model("base.en")
|
|
|
6 |
from transformers import pipeline
|
7 |
import torch
|
8 |
from summarizer import Summarizer
|
9 |
+
import ffmpeg
|
10 |
+
import speech_recognition as sr
|
11 |
+
from pytube import YouTube
|
12 |
+
import pandas as pd
|
13 |
+
import string
|
14 |
+
import whisper
|
15 |
+
from moviepy.editor import AudioFileClip
|
16 |
|
17 |
#Download youtube video
|
18 |
def download_audio(link):
|
19 |
with yt_dlp.YoutubeDL({'extract_audio': True, 'format': 'bestaudio', 'outtmpl': 'video.mp3'}) as video:
|
|
|
|
|
20 |
video.download(link)
|
21 |
+
|
22 |
+
#Convert video format
|
23 |
+
def convert_mp4_to_wav(mp4_file, wav_file):
|
24 |
+
video = AudioFileClip(mp4_file)
|
25 |
+
video.write_audiofile(wav_file)
|
26 |
|
27 |
#def portuguese_sum_pipeline(link):
|
28 |
# video_title = download_audio(link)
|
29 |
|
30 |
def english_sum_pipeline(link):
|
31 |
+
download_audio(link)
|
32 |
|
33 |
#audio-to-text
|
34 |
transcriptor = whisper.load_model("base.en")
|