Spaces:
Runtime error
Runtime error
Commit
·
077c8f8
1
Parent(s):
78b56a8
Update app.py
Browse files
app.py
CHANGED
@@ -7,12 +7,37 @@ def transcribe(audio):
|
|
7 |
text = pipe(audio)["text"]
|
8 |
return text
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
fn=transcribe,
|
12 |
inputs=gr.Audio(source="microphone", type="filepath"),
|
13 |
outputs="text",
|
14 |
title="Whisper Base",
|
15 |
-
description="Realtime demo for speech recognition using a fine-tuned Whisper
|
16 |
)
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
text = pipe(audio)["text"]
|
8 |
return text
|
9 |
|
10 |
+
def transcribe_video(link):
|
11 |
+
video=link
|
12 |
+
data=pytube.YouTube(video)
|
13 |
+
audio=data.streams.get_audio_only()
|
14 |
+
audio.download()
|
15 |
+
|
16 |
+
pattern=r".mp4$"
|
17 |
+
content=os.listdir()
|
18 |
+
for i in content:
|
19 |
+
if re.search(pattern,i) is not None:
|
20 |
+
video=i
|
21 |
+
|
22 |
+
text = pipe(video)["text"]
|
23 |
+
return text
|
24 |
+
|
25 |
+
iface1 = gr.Interface(
|
26 |
fn=transcribe,
|
27 |
inputs=gr.Audio(source="microphone", type="filepath"),
|
28 |
outputs="text",
|
29 |
title="Whisper Base",
|
30 |
+
description="Realtime demo for speech recognition using a fine-tuned Whisper-base model.",
|
31 |
)
|
32 |
|
33 |
+
iface2 = gr.Interface(
|
34 |
+
fn=transcribe,
|
35 |
+
inputs=gr.Textbox(label="Youtube Link",placeholder="Youtube Link"),
|
36 |
+
outputs=["text"],
|
37 |
+
title="Whisper Base",
|
38 |
+
description="Asynchronous demo for youtube speech recognition using a fine-tuned Whisper-base model.",
|
39 |
+
)
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
gr.Parallel(iface1,iface2).launch()
|