File size: 658 Bytes
d8c7b5e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()