Spaces:
Build error
Build error
Campfireman
commited on
Commit
•
ab4e539
1
Parent(s):
b937c0c
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,26 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
-
pipe = pipeline(model="
|
5 |
|
6 |
-
def transcribe(
|
|
|
7 |
text = pipe(audio)["text"]
|
8 |
return text
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
iface = gr.Interface(
|
11 |
fn=transcribe,
|
12 |
-
inputs=gr.
|
13 |
outputs="text",
|
14 |
-
title="Whisper
|
15 |
-
description="
|
16 |
)
|
17 |
|
18 |
iface.launch()
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
+
import moviepy.editor as mp
|
4 |
|
5 |
+
pipe = pipeline(model="Campfireman/whisper-medium-zh-CN") # change to "your-username/the-name-you-picked"
|
6 |
|
7 |
+
def transcribe(video):
|
8 |
+
audio = video_spliter(video)
|
9 |
text = pipe(audio)["text"]
|
10 |
return text
|
11 |
|
12 |
+
def video_spliter(video_in):
|
13 |
+
my_clip = mp.VideoFileClip(video_in)
|
14 |
+
my_audio = "audio_out.wav"
|
15 |
+
my_clip.audio.write_audiofile(my_audio)
|
16 |
+
return my_audio
|
17 |
+
|
18 |
iface = gr.Interface(
|
19 |
fn=transcribe,
|
20 |
+
inputs=gr.Video(...),
|
21 |
outputs="text",
|
22 |
+
title="Whisper Medium Chinese",
|
23 |
+
description="Video Chinese Transcriptior",
|
24 |
)
|
25 |
|
26 |
iface.launch()
|