Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,17 +2,16 @@ import gradio as gr
|
|
2 |
import whisper
|
3 |
import os
|
4 |
|
5 |
-
|
6 |
|
7 |
# main processing
|
8 |
-
def main(URL
|
9 |
video_path = youtube_dl(URL)
|
10 |
-
text = transcript(video_path
|
11 |
return text
|
12 |
|
13 |
# Transcribe text using Whisper
|
14 |
-
def transcript(video_path
|
15 |
-
model = whisper.load_model(model_size)
|
16 |
result = model.transcribe(video_path)
|
17 |
return result["text"]
|
18 |
|
@@ -40,9 +39,6 @@ with gr.Blocks() as demo:
|
|
40 |
with gr.Row():
|
41 |
url = gr.Textbox(placeholder = 'Youtube video URL', label = 'URL')
|
42 |
|
43 |
-
with gr.Row():
|
44 |
-
model_size = gr.Dropdown(choices = model_size, value = 'tiny', label = "Model")
|
45 |
-
|
46 |
with gr.Row():
|
47 |
transcribe_btn = gr.Button('Transcribe')
|
48 |
|
@@ -50,7 +46,7 @@ with gr.Blocks() as demo:
|
|
50 |
outputs = gr.Textbox(placeholder = 'Transcription of the video', label = 'Transcription')
|
51 |
|
52 |
transcribe_btn.click(fn = main,
|
53 |
-
inputs =
|
54 |
outputs = outputs
|
55 |
)
|
56 |
|
|
|
2 |
import whisper
|
3 |
import os
|
4 |
|
5 |
+
model = whisper.load_model("base")
|
6 |
|
7 |
# main processing
|
8 |
+
def main(URL):
|
9 |
video_path = youtube_dl(URL)
|
10 |
+
text = transcript(video_path)
|
11 |
return text
|
12 |
|
13 |
# Transcribe text using Whisper
|
14 |
+
def transcript(video_path):
|
|
|
15 |
result = model.transcribe(video_path)
|
16 |
return result["text"]
|
17 |
|
|
|
39 |
with gr.Row():
|
40 |
url = gr.Textbox(placeholder = 'Youtube video URL', label = 'URL')
|
41 |
|
|
|
|
|
|
|
42 |
with gr.Row():
|
43 |
transcribe_btn = gr.Button('Transcribe')
|
44 |
|
|
|
46 |
outputs = gr.Textbox(placeholder = 'Transcription of the video', label = 'Transcription')
|
47 |
|
48 |
transcribe_btn.click(fn = main,
|
49 |
+
inputs = url,
|
50 |
outputs = outputs
|
51 |
)
|
52 |
|