URL-to-Whisper / app.py
mdnestor's picture
Create new file
d8c7b5e
raw
history blame contribute delete
658 Bytes
import gradio as gr
import os
import whisper
model = whisper.load_model("base")
def transcribe(url):
os.system(f"yt-dlp -x {url} -o audio.m4a")
result = model.transcribe("audio.m4a")
return result['text']
with gr.Blocks() as demo:
gr.HTML(
"""
<p>
Transcribes web videos to text using OpenAI's Whisper (base model).
Works on many sites such as YouTube, Twitter, Reddit, Instagram, etc.
</p>
"""
)
url = gr.Textbox(placeholder="Enter video link here...", label="")
button = gr.Button("Transcribe!")
output = gr.Textbox(label="")
button.click(transcribe, inputs=[url], outputs=[output])
demo.launch()