afroanton commited on
Commit
861d639
1 Parent(s): db29bad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -1,5 +1,7 @@
1
  from transformers import pipeline
2
  import gradio as gr
 
 
3
 
4
  pipe = pipeline(model="afroanton/whisper-small-sv-SE") # change to "your-username/the-name-you-picked"
5
 
@@ -7,9 +9,19 @@ def transcribe(audio):
7
  text = pipe(audio)["text"]
8
  return text
9
 
 
 
 
 
 
 
10
  video_demo = gr.Interface.load(
11
  fn=transcribe,
12
- inputs="text",
 
 
 
 
13
  outputs="text",
14
  title="Whisper Small Swedish",
15
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
 
1
  from transformers import pipeline
2
  import gradio as gr
3
+ from pytube import YouTube
4
+ import os
5
 
6
  pipe = pipeline(model="afroanton/whisper-small-sv-SE") # change to "your-username/the-name-you-picked"
7
 
 
9
  text = pipe(audio)["text"]
10
  return text
11
 
12
+ def transcribeUrl(url):
13
+ yt = YouTube(str(url))
14
+ audio = yt.streams.filter(only_audio=True).first()
15
+ text = pipe(audio)["text"]
16
+ return text
17
+
18
  video_demo = gr.Interface.load(
19
  fn=transcribe,
20
+ inputs=gr.Textbox(
21
+ label="insert URL",
22
+ lines=3,
23
+ value="The fast brown fox jumps over lazy dogs.",
24
+ ),
25
  outputs="text",
26
  title="Whisper Small Swedish",
27
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",