alizabista's picture
fix: change to filter
ab1f8d2
raw
history blame contribute delete
446 Bytes
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()