mdnestor commited on
Commit
d8c7b5e
1 Parent(s): c8aeea3

Create new file

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ import whisper
4
+
5
+ model = whisper.load_model("base")
6
+
7
+ def transcribe(url):
8
+ os.system(f"yt-dlp -x {url} -o audio.m4a")
9
+ result = model.transcribe("audio.m4a")
10
+ return result['text']
11
+
12
+ with gr.Blocks() as demo:
13
+ gr.HTML(
14
+ """
15
+ <p>
16
+ Transcribes web videos to text using OpenAI's Whisper (base model).
17
+ Works on many sites such as YouTube, Twitter, Reddit, Instagram, etc.
18
+ </p>
19
+ """
20
+ )
21
+ url = gr.Textbox(placeholder="Enter video link here...", label="")
22
+ button = gr.Button("Transcribe!")
23
+ output = gr.Textbox(label="")
24
+ button.click(transcribe, inputs=[url], outputs=[output])
25
+
26
+ demo.launch()