Spaces:
Runtime error
Runtime error
gradio app
Browse files- app.py +24 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
from pytube import YouTube
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
pipe = pipeline(model="id2223lab1/whisper-small")
|
6 |
+
|
7 |
+
|
8 |
+
def transcribe(url):
|
9 |
+
audio = YouTube(url).streams.filter(file_extension='mp4', only_audio=True).first().download()
|
10 |
+
|
11 |
+
text = pipe(audio, batch_size=512, truncation=True)["text"]
|
12 |
+
|
13 |
+
return text
|
14 |
+
|
15 |
+
|
16 |
+
iface = gr.Interface(
|
17 |
+
fn=transcribe,
|
18 |
+
inputs=gr.Textbox(label="Enter the URL of the Youtube video clip here (without prefixes like http://):"),
|
19 |
+
outputs="text",
|
20 |
+
title="Whisper Small SE",
|
21 |
+
description="Video Swedish Transcriptior",
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
pytube
|