alizabista's picture
feat: added transcribe func
c82d13d
raw
history blame
444 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.first(only_audio=True).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()