File size: 446 Bytes
3030dac
c82d13d
 
3030dac
 
c82d13d
 
 
ab1f8d2
c82d13d
 
 
 
 
 
 
3030dac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
import pytube
import whisper


def get_audio(video_url):
    # Download YouTube video
    yt = pytube.YouTube(video_url)
    return yt.streams.filter(only_audio=True)[0].download(filename="tmpvideo.mp4")

def transcribe(video_url):
    # Transcribe audio
    model = whisper.load_model("base")
    return model.transcribe(get_audio(video_url))

iface = gr.Interface(fn=transcribe, inputs="text", outputs="text")
iface.launch()