Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +13 -9
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,21 +1,25 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
-
from
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
10 |
text = pipe(audio)["text"]
|
11 |
return text
|
12 |
|
13 |
iface = gr.Interface(
|
14 |
-
fn=transcribe,
|
15 |
-
inputs=
|
|
|
|
|
|
|
16 |
outputs="text",
|
17 |
-
title="Whisper Small
|
18 |
-
description="Realtime demo for
|
19 |
)
|
20 |
|
21 |
iface.launch()
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
+
from pytube import YouTube
|
4 |
|
5 |
+
pipe = pipeline(model="kk90ujhun/whisper-small-zh") # change to "your-username/the-name-you-picked"
|
6 |
|
7 |
+
def transcribe(audio,url):
|
8 |
+
if url:
|
9 |
+
youtubeObject = YouTube(url).streams.first().download()
|
10 |
+
audio = youtubeObject
|
11 |
text = pipe(audio)["text"]
|
12 |
return text
|
13 |
|
14 |
iface = gr.Interface(
|
15 |
+
fn=transcribe,
|
16 |
+
inputs=[
|
17 |
+
gr.Audio(source="microphone", type="filepath"),
|
18 |
+
gr.inputs.Textbox(label="give me an url",default ="https://www.youtube.com/watch?v=YzGsIavAo_E")
|
19 |
+
],
|
20 |
outputs="text",
|
21 |
+
title="Whisper Small Chinese",
|
22 |
+
description="Realtime demo for chinese speech recognition using a fine-tuned Whisper small model.",
|
23 |
)
|
24 |
|
25 |
iface.launch()
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
gradio
|
2 |
git+https://github.com/huggingface/transformers
|
3 |
-
|
|
|
1 |
gradio
|
2 |
git+https://github.com/huggingface/transformers
|
3 |
+
pytube
|