Spaces:
Runtime error
Runtime error
Manbearpig01
commited on
Commit
•
d22a190
1
Parent(s):
18d1026
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,18 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""app.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colaboratory.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1SLY6vFgJGYJxXCiJWtRo3Qxag5r_Y4K7
|
8 |
-
"""
|
9 |
import os
|
10 |
import gradio as gr
|
11 |
from transformers import pipeline
|
12 |
from pytube import YouTube
|
13 |
|
14 |
|
15 |
-
pipe = pipeline(model="Manbearpig01/whisper-small-hi")
|
|
|
16 |
|
17 |
|
18 |
def yt(link):
|
19 |
yt = YouTube(link)
|
20 |
stream = yt.streams.filter(only_audio=True)[0]
|
21 |
-
stream.download(filename="audio.
|
22 |
-
text = pipe("audio.
|
23 |
return text
|
24 |
|
25 |
def transcribe(audio):
|
@@ -40,13 +33,16 @@ iface = gr.Interface(
|
|
40 |
yt = gr.Interface(
|
41 |
fn=yt,
|
42 |
inputs=[gr.inputs.Textbox(lines=1, label="Youtube URL")],
|
43 |
-
outputs=["
|
44 |
title="Whisper Small Swedish-Youtube",
|
45 |
-
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model. A Youtube URL for recognize."
|
|
|
46 |
|
47 |
)
|
48 |
|
49 |
with demo:
|
50 |
gr.TabbedInterface([iface, yt], ["Transcribe Audio", "Transcribe YouTube"])
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline
|
4 |
from pytube import YouTube
|
5 |
|
6 |
|
7 |
+
pipe = pipeline(model="Manbearpig01/whisper-small-hi")
|
8 |
+
#https://www.youtube.com/watch?v=IagbSHyZ5iA
|
9 |
|
10 |
|
11 |
def yt(link):
|
12 |
yt = YouTube(link)
|
13 |
stream = yt.streams.filter(only_audio=True)[0]
|
14 |
+
stream.download(filename="audio.mp4")
|
15 |
+
text = pipe("audio.mp4")["text"]
|
16 |
return text
|
17 |
|
18 |
def transcribe(audio):
|
|
|
33 |
yt = gr.Interface(
|
34 |
fn=yt,
|
35 |
inputs=[gr.inputs.Textbox(lines=1, label="Youtube URL")],
|
36 |
+
outputs=["text"],
|
37 |
title="Whisper Small Swedish-Youtube",
|
38 |
+
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model. A Youtube URL for recognize. Suggest link1: https://www.youtube.com/watch?v=IagbSHyZ5iA link2:https://www.youtube.com/watch?v=gjvOMoDf4-4"
|
39 |
+
|
40 |
|
41 |
)
|
42 |
|
43 |
with demo:
|
44 |
gr.TabbedInterface([iface, yt], ["Transcribe Audio", "Transcribe YouTube"])
|
45 |
|
46 |
+
|
47 |
+
|
48 |
+
demo.launch(enable_queue=True)
|