Spaces:
Runtime error
Runtime error
ffmpeg
Browse files- app.py +3 -3
- packages.txt +1 -0
app.py
CHANGED
@@ -56,9 +56,9 @@ def encode_video(video_path):
|
|
56 |
return video
|
57 |
|
58 |
def extract_audio(video_path):
|
59 |
-
|
60 |
audio_path = "temp_audio.wav"
|
61 |
-
|
62 |
return audio_path
|
63 |
|
64 |
def transcribe_audio(audio_file):
|
@@ -68,7 +68,7 @@ def transcribe_audio(audio_file):
|
|
68 |
inputs = ffmpeg_read(inputs, asr_pipeline.feature_extractor.sampling_rate)
|
69 |
inputs = {"array": inputs, "sampling_rate": asr_pipeline.feature_extractor.sampling_rate}
|
70 |
|
71 |
-
transcription = asr_pipeline(inputs, batch_size=8, generate_kwargs={"task": "transcribe"}, return_timestamps=
|
72 |
return transcription
|
73 |
|
74 |
@spaces.GPU
|
|
|
56 |
return video
|
57 |
|
58 |
def extract_audio(video_path):
|
59 |
+
import subprocess
|
60 |
audio_path = "temp_audio.wav"
|
61 |
+
subprocess.call(['ffmpeg', '-i', video_path, '-ab', '160k', '-ac', '2', '-ar', '44100', '-vn', audio_path])
|
62 |
return audio_path
|
63 |
|
64 |
def transcribe_audio(audio_file):
|
|
|
68 |
inputs = ffmpeg_read(inputs, asr_pipeline.feature_extractor.sampling_rate)
|
69 |
inputs = {"array": inputs, "sampling_rate": asr_pipeline.feature_extractor.sampling_rate}
|
70 |
|
71 |
+
transcription = asr_pipeline(inputs, batch_size=8, generate_kwargs={"task": "transcribe"}, return_timestamps=True)["text"]
|
72 |
return transcription
|
73 |
|
74 |
@spaces.GPU
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ffmpeg
|