Spaces:
Running
Running
Commit
·
c82d13d
1
Parent(s):
3030dac
feat: added transcribe func
Browse files- app.py +15 -3
- requirements.txt +3 -0
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import pytube
|
3 |
+
import whisper
|
4 |
|
|
|
|
|
5 |
|
6 |
+
|
7 |
+
def get_audio(video_url):
|
8 |
+
# Download YouTube video
|
9 |
+
yt = pytube.YouTube(video_url)
|
10 |
+
return yt.streams.first(only_audio=True).download(filename="tmpvideo.mp4")
|
11 |
+
|
12 |
+
|
13 |
+
def transcribe(video_url):
|
14 |
+
# Transcribe audio
|
15 |
+
model = whisper.load_model("base")
|
16 |
+
return model.transcribe(get_audio(video_url))
|
17 |
+
|
18 |
+
iface = gr.Interface(fn=transcribe, inputs="text", outputs="text")
|
19 |
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
pytube
|
3 |
+
git+https://github.com/openai/whisper.git
|